我有一个分隔文件,其中分隔符是NOT character (¬),我无法使用pandas解析它-请看下面,列没有正确拆分。在
test = pd.read_csv("file.csv", sep="¬", encoding="latin-1")
test.head(1)
0 1231�XXX7791�BBB9991�22999KKKK...
test.shape
Out[128]: (7001001, 1)
我使用的是ipython3.2.0,pandas 0.16.2,2.7.10.final.0。在
Tags:
前面的代码会给我这个,这就是你想要的。您只需将正确的UTF-8编码称为
^{pr2}$sep
您需要
engine=python
,因为默认情况下,pandas
使用不支持regex分隔符的engine=c
。在来自IPython
相关问题 更多 >
编程相关推荐