-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
Fix ValueError when reading a Dataframe with HDFStore in Python 3 fro… #24510
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
Changes from 7 commits
66c7e8d
5fff786
e80ea1b
0a7e2e4
4f224f2
554d0c5
a33fb2c
173265c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4540,6 +4540,21 @@ def test_pytables_native2_read(self, datapath): | |
d1 = store['detector'] | ||
assert isinstance(d1, DataFrame) | ||
|
||
def test_legacy_table_fixed_format_read_py2(self, datapath): | ||
# GH 24510 | ||
# legacy table with fixed format written en Python 2 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. add the issue number here as a comments There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Added |
||
with ensure_clean_store( | ||
datapath('io', 'data', 'legacy_hdf', | ||
'legacy_table_fixed_py2.h5'), | ||
mode='r') as store: | ||
with catch_warnings(): | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. what are the warnings from? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I just used test_legacy_table_read(...) as a template to read the file. I removed this context manager locally and the test is still ok. I'll commit it. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. great |
||
result = store.select('df') | ||
expected = pd.DataFrame([[1, 2, 3, 'D']], | ||
columns=['A', 'B', 'C', 'D'], | ||
index=pd.Index(['ABC'], | ||
name='INDEX_NAME')) | ||
assert_frame_equal(expected, result) | ||
|
||
def test_legacy_table_read(self, datapath): | ||
# legacy table types | ||
with ensure_clean_store( | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you can just directly call this, no if is needed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done