将 Pandas DataFrame 写入羽毛文件时出错
Error when writing Pandas DataFrame to feather file
同时 运行:
df.to_feather(file_path)
发生以下错误:
Traceback (most recent call last):
File "X:\FAKE\script.py", line 37, in df_to_feather
df.to_feather(file_path)
File "X:\FAKE\venv\lib\site-packages\pandas\util\_decorators.py", line 214, in wrapper
return func(*args, **kwargs)
File "X:\FAKE\venv\lib\site-packages\pandas\core\frame.py", line 1994, in to_feather
to_feather(self, path)
File "X:\FAKE\venv\lib\site-packages\pandas\io\feather_format.py", line 64, in to_feather
feather.write_feather(df, path)
File "X:\FAKE\venv\lib\site-packages\pyarrow\feather.py", line 183, in write_feather
writer.write(df)
File "X:\FAKE\venv\lib\site-packages\pyarrow\feather.py", line 98, in write
self.writer.write_array(name, col.chunk(0))
File "pyarrow\feather.pxi", line 67, in pyarrow.lib.FeatherWriter.write_array
File "pyarrow\error.pxi", line 105, in pyarrow.lib.check_status
pyarrow.lib.ArrowNotImplementedError: extension<pandas.period>
如果知道如何解决这个问题,我们将不胜感激。 :)
最后一行:
pyarrow.lib.ArrowNotImplementedError: extension<pandas.period>
告诉您 pandas.Period
数据类型当前未针对羽化格式实现。它是一列或您的索引。您可以尝试使用 .asfreq()
方法将其转换为期间的 start/end,或者您可以使用 .to_timestamp()
方法将其转换为时间戳。
同时 运行:
df.to_feather(file_path)
发生以下错误:
Traceback (most recent call last):
File "X:\FAKE\script.py", line 37, in df_to_feather
df.to_feather(file_path)
File "X:\FAKE\venv\lib\site-packages\pandas\util\_decorators.py", line 214, in wrapper
return func(*args, **kwargs)
File "X:\FAKE\venv\lib\site-packages\pandas\core\frame.py", line 1994, in to_feather
to_feather(self, path)
File "X:\FAKE\venv\lib\site-packages\pandas\io\feather_format.py", line 64, in to_feather
feather.write_feather(df, path)
File "X:\FAKE\venv\lib\site-packages\pyarrow\feather.py", line 183, in write_feather
writer.write(df)
File "X:\FAKE\venv\lib\site-packages\pyarrow\feather.py", line 98, in write
self.writer.write_array(name, col.chunk(0))
File "pyarrow\feather.pxi", line 67, in pyarrow.lib.FeatherWriter.write_array
File "pyarrow\error.pxi", line 105, in pyarrow.lib.check_status
pyarrow.lib.ArrowNotImplementedError: extension<pandas.period>
如果知道如何解决这个问题,我们将不胜感激。 :)
最后一行:
pyarrow.lib.ArrowNotImplementedError: extension<pandas.period>
告诉您 pandas.Period
数据类型当前未针对羽化格式实现。它是一列或您的索引。您可以尝试使用 .asfreq()
方法将其转换为期间的 start/end,或者您可以使用 .to_timestamp()
方法将其转换为时间戳。