Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
DataFrame with PeriodIndex written in Python2 gets an Int64Index when read back in Python3 #16781
Code Sample, a copy-pastable example if possible
Writing this DataFrame out via HDF5 in Python2.7, then reading back in Python3.6 causes the DataFrame to have an Int64Index rather than a PeriodIndex:
The deserialized index should look like this:
The index is correctly deserialized when reading it back in from Python2.7. The index is also correctly deserialized when reading a file that was written in Python3.6. I don't know if we guarantee 2.7 -> 3.6 compatibility for an on-disk HDF file?
I've attached an HDF file written in Python2.7 and a similar HDF file written in Python3.6.
It's the index_class coming out as the bytes b'period' rather than the string
Confirmed.. this fixes the issue for me: