BUG: The frequency of a DatetimeIndex is lost when using to_parquet with pyarrow #41543
Open
3 tasks done
Labels
Bug
freq retention
User expects "freq" attribute to be preserved
Frequency
DateOffsets
IO Parquet
parquet, feather
I have checked that this issue has not already been reported.
I have confirmed this bug exists on the latest version of pandas.
(optional) I have confirmed this bug exists on the master branch of pandas.
Code Sample
Problem description
With the following versions:
The bug is different with fastparquet, but there seem to be also a consistency issue (the index name).
Which I didn't see in earlier versions of pandas/fastparquet (0.25.3/0.4.1), I didn't try other combinations.
EDIT: It wasn't happening before most likely because assert_frame_equal wasn't checking the index frequency, not because it was there.
It seems that the index frequency is not passed in the pandas metadata within the table.
Maybe I'm missing a pyarrow option to make this happen, but I still feel like the index should be either discarded completely or kept in a compatible manner.
Expected Output
No exception raised and an index with the same attributes as the original one.
Output of
pd.show_versions()
INSTALLED VERSIONS
commit : 2cb9652
python : 3.8.8.final.0
python-bits : 64
OS : Linux
OS-release : 5.4.0-72-generic
Version : #80~18.04.1-Ubuntu SMP Mon Apr 12 23:26:25 UTC 2021
machine : x86_64
processor : x86_64
byteorder : little
LC_ALL : None
LANG : en_US.UTF-8
LOCALE : en_US.UTF-8
pandas : 1.2.4
numpy : 1.20.3
pytz : 2021.1
dateutil : 2.8.1
pip : 21.0.1
setuptools : 52.0.0.post20210125
Cython : None
pytest : None
hypothesis : None
sphinx : None
blosc : None
feather : None
xlsxwriter : None
lxml.etree : None
html5lib : None
pymysql : None
psycopg2 : None
jinja2 : None
IPython : None
pandas_datareader: None
bs4 : None
bottleneck : None
fsspec : 2021.05.0
fastparquet : 0.6.3
gcsfs : None
matplotlib : None
numexpr : None
odfpy : None
openpyxl : None
pandas_gbq : None
pyarrow : 4.0.0
pyxlsb : None
s3fs : None
scipy : None
sqlalchemy : None
tables : None
tabulate : None
xarray : None
xlrd : None
xlwt : None
numba : None
The text was updated successfully, but these errors were encountered: