Skip to content

Fix read of py27 pytables tz attribute, gh#26443 #28221

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Aug 30, 2019

Conversation

quintusdias
Copy link
Contributor

@quintusdias quintusdias commented Aug 29, 2019

When created by python 2.7, the "tz" attribute will be created with CSET
H5T_CSET_ASCII instead of H5T_CSET_UTF8, therefore it is read as bytes
when string is expected.

When created by python 2.7, the "tz" attribute will be created with CSET
H5T_CSET_ASCII instead of H5T_CSET_UTF8, therefore it is read as bytes
when string is expected.
@simonjayhawkins simonjayhawkins added the IO HDF5 read_hdf, HDFStore label Aug 29, 2019
When created by python 2.7, the "tz" attribute will be created with CSET
H5T_CSET_ASCII instead of H5T_CSET_UTF8, therefore it is read as bytes
when string is expected.
Conflicts:
	doc/source/whatsnew/v1.0.0.rst
	pandas/tests/io/pytables/test_pytables.py
@WillAyd
Copy link
Member

WillAyd commented Aug 30, 2019

Thanks for the PR but not sure about this as it makes it murky as to what aspects of Py27 we still support. Without this its very clear to say nothing, so I'm maybe -1 on this as I don't think we want to start down the path of offering any Py27 legacy support going forward.

Let's see what others think

Copy link
Contributor

@TomAugspurger TomAugspurger left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a bit of a gray area, but since it's a low-maintenance change I think it's OK to merge.

The test HDF5 file was created in Python2, but could not be read in
Python3.

GH26443
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is typically written as a comment.

@@ -97,6 +97,7 @@ Datetimelike
^^^^^^^^^^^^
- Bug in :meth:`Series.__setitem__` incorrectly casting ``np.timedelta64("NaT")`` to ``np.datetime64("NaT")`` when inserting into a :class:`Series` with datetime64 dtype (:issue:`27311`)
- Bug in :meth:`Series.dt` property lookups when the underlying data is read-only (:issue:`27529`)
- Bug in :meth:`HDFStore.__getitem__` incorrectly reading tz attribute created in Py2 (:issue:`26443`)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Py2 -> Python 2.

@@ -97,6 +97,7 @@ Datetimelike
^^^^^^^^^^^^
- Bug in :meth:`Series.__setitem__` incorrectly casting ``np.timedelta64("NaT")`` to ``np.datetime64("NaT")`` when inserting into a :class:`Series` with datetime64 dtype (:issue:`27311`)
- Bug in :meth:`Series.dt` property lookups when the underlying data is read-only (:issue:`27529`)
- Bug in :meth:`HDFStore.__getitem__` incorrectly reading tz attribute created in Py2 (:issue:`26443`)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think magic methods are in the docs.

It also seems like we don't have a generic HDFStore reference, so just write this as double backticks rather than :meth:.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, will commit again.

@WillAyd WillAyd added this to the 1.0 milestone Aug 30, 2019
Copy link
Member

@WillAyd WillAyd left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fine with this as well - @TomAugspurger for 1.0.0 or 0.25.2?

@TomAugspurger
Copy link
Contributor

1.0 (I don't think it was a 0.25.x regression).

@WillAyd WillAyd merged commit cad3918 into pandas-dev:master Aug 30, 2019
MarcoGorelli pushed a commit to MarcoGorelli/pandas that referenced this pull request Sep 3, 2019
proost pushed a commit to proost/pandas that referenced this pull request Dec 19, 2019
proost pushed a commit to proost/pandas that referenced this pull request Dec 19, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
IO HDF5 read_hdf, HDFStore
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Py3 Failed to read HDF5 created in Py2 with datetime timezone
4 participants