熊猫给出错误以读取txt数据文件

时间:2020-06-14 03:49:27

标签: python pandas

这是我正在使用的代码,由于某种原因它无法正常工作。请帮帮我。

我已经创建了一个包含一些数据的文本文件,当我尝试使用Pandas读取数据时,它无法正常工作。

dF = pd.read_csv("PandasLongSample.txt", delimiter='/t')
print(dF)

这是错误:

C:\Users\SVISHWANATH\AppData\Local\Continuum\anaconda3\lib\site-packages\ipykernel_launcher.py:1: ParserWarning: Falling back to the 'python' engine because the 'c' engine does not support regex separators (separators > 1 char and different from '\s+' are interpreted as regex); you can avoid this warning by specifying engine='python'.
  """Entry point for launching an IPython kernel.

感谢您的帮助!

2 个答案:

答案 0 :(得分:3)

在制表符分隔符中使用反斜杠(\)而不是斜杠(/)。

dF = pd.read_csv("PandasLongSample.txt", delimiter='\t')
print(dF)

答案 1 :(得分:0)

您的代码中有一个错字,应该是\t而不是/t