[英]How to fix (what I think is) an encoding issue when exporting python dictionary to .csv file using pandas DataFrame?
[英]Python Pandas: Error when exporting DataFrame to CSV file
尝试将 pandas DataFrame 导出到 csv 时出现以下错误。
Traceback (most recent call last):
File "C:/Users/riley/PycharmProjects/EarlyPaidLoanReport/EarlyPaidOff.py", line 91, in <module>
LastTransactionDate.to_csv(LastTransactionDate, 'example.csv')
File "C:\Users\riley\Anaconda3\lib\site-packages\pandas\core\frame.py", line 1344, in to_csv
formatter.save()
File "C:\Users\riley\Anaconda3\lib\site-packages\pandas\formats\format.py", line 1526, in save
compression=self.compression)
File "C:\Users\riley\Anaconda3\lib\site-packages\pandas\io\common.py", line 424, in _get_handle
f = open(path, mode, errors='replace')
TypeError: invalid file: AutoNumber LoanAgreementID \
我不确定为什么会收到此错误。 我过去曾多次使用 pandas 写信给 csv。 有人可以帮忙解决这个错误吗?
LastTransactionDate.to_csv(LastTransactionDate, 'example.csv')
你的语法是错误的。 除非我遗漏了什么,否则请执行以下操作:
LastTransactionDate.to_csv('example.csv')
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.