0

在跑步的时候:

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>

任何想法如何解决这个问题将不胜感激。:)

4

1 回答 1

1

最后一行:

pyarrow.lib.ArrowNotImplementedError: extension<pandas.period>

告诉你数据类型pandas.Period目前没有为羽毛格式实现。它是一列或您的索引。您可以尝试使用方法将其转换为期间的开始/结束.asfreq(),也可以使用该.to_timestamp()方法将其转换为时间戳。

于 2020-03-07T13:11:43.250 回答