如何解决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 举报,一经查实,本站将立刻删除。