pandas.errors.EmptyDataError:没有可从文件python解析的列

问题描述

一个python脚本将数据存储到csv文件中,并更新实时数据并存储数据,另外还有一个python脚本正在读取同一文件,有时会出现错误

script A (writing the live data)
livedata.to_csv('c.csv')

script B(reading the live data)
df=pd.read_csv('c.csv')
 df=pd.DataFrame(df)

showing the below error,sometime script runs for 30 mins correctly and suddenly shows the below error.
Traceback (most recent call last):
  File "livesystem.py",line 176,in <module>
  File "livesystem.py",line 157,in main
  File "pandas\io\parsers.py",line 686,in read_csv
  File "pandas\io\parsers.py",line 452,in _read
  File "pandas\io\parsers.py",line 946,in __init__
  File "pandas\io\parsers.py",line 1178,in _make_engine
  File "pandas\io\parsers.py",line 2008,in __init__
  File "pandas\_libs\parsers.pyx",line 540,in pandas._libs.parsers.TextReader.__cinit__
pandas.errors.EmptyDataError: No columns to parse from file```

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)