我知道在CSV文件中有很多关于空格分隔符的问题。在
我有一个CSV文件,似乎是用空格隔开的。当导入到Python时,我尝试了所有代码来将空格标识为分隔符。但是,我总是收到错误消息。例如:test_filepath = 'test_data.csv'
with codecs.open(test_filepath, "r", "Shift-JIS", "ignore") as file: # import UTF8 based csv file
test_df = pd.read_table( file, delim_whitespace=True )
这将产生以下错误:
^{pr2}$
当我尝试这个:test_filepath = 'test_data.csv'
with codecs.open(test_filepath, "r", "Shift-JIS", "ignore") as file: # import UTF8 based csv file
test_df = pd.read_table( file, delimiter=" " )
它给出了同样的错误。在
当我尝试这个:test_filepath = 'test_data.csv'
with codecs.open(test_filepath, "r", "Shift-JIS", "ignore") as file: # import UTF8 based csv file
test_df = pd.read_table( file, sep = "/s+" )
我也有同样的错误。在
当我尝试这个:test_filepath = 'test_data.csv'
with codecs.open(test_filepath, "r", "Shift-JIS", "ignore") as file: # import UTF8 based csv file
test_df = pd.read_table( file, delimiter='\t')
我也有同样的错误。在
唯一不出错的方法是:test_filepath = 'test_data.csv'
with codecs.open(test_filepath, "r", "Shift-JIS", "ignore") as file: # import UTF8 based csv file
test_df = pd.read_table( file, delimiter=',')
但是结果看起来完全不一样_测向信息()显示只创建了一列(应该有大约100列)。在