用" ^"读取csv; + C引擎的字符分隔符

时间:2014-08-08 13:27:48

标签: python csv pandas

我有一个文件如下:

$ head my_file
NVQe2jNT^A1407334383000^A7050
Oo6juv39^A1407334164000^A30
z0mLJub2^A1407334518000^A75

字段分隔符实际上是^A。如果我这样做:

df = pd.read_csv('my_file', sep='\^A')

或:

df = pd.read_csv('my_file', sep='^A')

我明白了:

/Users/josh/anaconda/envs/py27/lib/python2.7/site-packages/pandas/io/parsers.py:624: 
ParserWarning: Falling back to the 'python' engine because the 'c' engine does not 
support regex separators; you can avoid this warning by specifying engine='python'.                             

有没有办法对这个文件使用C引擎?

1 个答案:

答案 0 :(得分:0)

df = pd.read_csv('my_file',sep ='^ A',engine ='python')