Skip to content

BUG: Reading from parquet throws UnknownTimeZoneError using timezone-aware date in index #35997

Closed
@alippai

Description

@alippai
  • I have checked that this issue has not already been reported.

  • I have confirmed this bug exists on the latest version of pandas.

import pandas as pd
from datetime import datetime, timezone

df = pd.DataFrame([[datetime.now(timezone.utc)]], columns=['date']).set_index('date')
df.to_parquet('out.parquet')
pd.read_parquet('out.parquet')

Problem description

The bug above happens with pandas 1.1.1 and pyarrow 1.0.1.
The timezone-aware date in the index should survive the parquet round trip.
If date is not index, or when I add parameter ignore_metadata=True to the pyarrow.Table.to_pandas() it works (but date won't be an index automatically)

Expected Output

A correct DataFrame

Output of pd.show_versions()

INSTALLED VERSIONS ------------------ commit : f2ca0a2 python : 3.8.2.final.0 python-bits : 64 OS : Linux OS-release : 4.19.104-microsoft-standard Version : #1 SMP Wed Feb 19 06:37:35 UTC 2020 machine : x86_64 processor : x86_64 byteorder : little LC_ALL : None LANG : C.UTF-8 LOCALE : en_US.UTF-8

pandas : 1.1.1
numpy : 1.19.1
pytz : 2020.1
dateutil : 2.8.1
pip : 20.2.2
setuptools : 49.6.0
Cython : None
pytest : None
hypothesis : None
sphinx : None
blosc : None
feather : None
xlsxwriter : None
lxml.etree : None
html5lib : None
pymysql : None
psycopg2 : None
jinja2 : 2.11.2
IPython : 7.18.1
pandas_datareader: None
bs4 : None
bottleneck : None
fsspec : None
fastparquet : None
gcsfs : None
matplotlib : 3.3.1
numexpr : None
odfpy : None
openpyxl : None
pandas_gbq : None
pyarrow : 1.0.1
pytables : None
pyxlsb : None
s3fs : None
scipy : 1.5.2
sqlalchemy : None
tables : None
tabulate : None
xarray : None
xlrd : None
xlwt : None
numba : None

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions