Transfer and write Parquet with python and pandas got timestamp error

前端 未结 5 2263
春和景丽
春和景丽 2021-02-19 00:44

I tried to concat() two parquet file with pandas in python .
It can work , but when I try to write and save the Data frame to a parquet file ,it display the error :

<
5条回答
  •  我在风中等你
    2021-02-19 01:22

    Thanks to @axel for the link to Apache Arrow documentation:

    allow_truncated_timestamps (bool, default False) – Allow loss of data when coercing timestamps to a particular resolution. E.g. if microsecond or nanosecond data is lost when coercing to ‘ms’, do not raise an exception.

    It seems like in modern Pandas versions we can pass parameters to ParquetWriter.

    The following code worked properly for me (Pandas 1.1.1, PyArrow 1.0.1):

    df.to_parquet(filename, use_deprecated_int96_timestamps=True)
    

提交回复
热议问题