You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
d= {"data": 123}
df=pd.DataFrame(d, index=[pd.Timestamp("2019-01-01T18:00").tz_localize('America/New_York')])
df.to_hdf('/tmp/test.h5', key="key") # write in Python 2df=pd.read_hdf('/tmp/test.h5', key="key") # failed in py3print(df)
Problem description
When a dataframe contains a column with datetime with timezone, and this dataframe is written as hd5 in Python 2. Python 3 is unable to read it. The error is
...
~/miniconda3/envs/SOMEENV/lib/python3.7/site-packages/pandas/core/indexes/datetimelike.py in _format_with_header(self, header, **kwargs)
431
432 def _format_with_header(self, header, **kwargs):
--> 433 return header + list(self._format_native_types(**kwargs))
434
435 @property
~/miniconda3/envs/SOMEENV/lib/python3.7/site-packages/pandas/core/indexes/datetimes.py in _format_native_types(self, na_rep, date_format, **kwargs)
450 tz=self.tz,
451 format=fmt,
--> 452 na_rep=na_rep)
453
454 @property
pandas/_libs/tslib.pyx in pandas._libs.tslib.format_array_from_datetime()
pandas/_libs/tslibs/timestamps.pyx in pandas._libs.tslibs.timestamps.Timestamp.__new__()
pandas/_libs/tslibs/conversion.pyx in pandas._libs.tslibs.conversion.convert_to_tsobject()
TypeError: Cannot convert numpy.bytes_ to datetime.tzinfo
Expected Output
Python 3 should be able to read the dataframe written by Python 2
Code Sample, a copy-pastable example if possible
Problem description
When a dataframe contains a column with datetime with timezone, and this dataframe is written as hd5 in Python 2. Python 3 is unable to read it. The error is
Expected Output
Python 3 should be able to read the dataframe written by Python 2
Output of
pd.show_versions()
Python 3
Python 2
The text was updated successfully, but these errors were encountered: