-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
str'ified column names in DataFrame.to_hdf(); Fixes #9057 #9902
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
Conversation
Converted column names to strings before creating pytables metadata object
periods=N,freq='ms')) | ||
|
||
self.filename = NamedTemporaryFile(suffix='.h5', delete=False).name | ||
df.to_hdf(self.filename,'df', mode='w', format='table', |
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.
these all need to go in io/tests/test_pytables.py
Yeah, my bad, that makes sense. I moved them over. |
@@ -4623,6 +4624,27 @@ def _test_sort(obj): | |||
else: | |||
raise ValueError('type not supported here') | |||
|
|||
class TestToHdfWithIntegerColumnNames(tm.TestCase): | |||
# GH9057 | |||
def setUp(self): |
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.
pls test the way everything else is done
eg use ensure_clean for a file
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.
pls give a test with Unicode column names
the reason for not allowing this is that queries become non-obvious and the data does not correctly round trip so I suppoose this is ok but needs a warning to show that this is losing data |
pls do the tests like the others, e.g. use |
pls add a warning when things are stringified as well (as this is generally something which is not obvious and makes querying different). |
Do you think that it's better to just straight-up disallow |
I think it might be better to raise a more informative error message the point of the Table format is to query and so have integer names though can work is a bit odd |
@jameshiebert I think let's just raise an error message. Pls rebase and update. |
Sounds good. Closing this in favor of #10098 |
closes #9057
Converted column names to strings before creating pytables metadata object
This brute force
str()
ing method might not be the best approach, but AFAIK it hasn't broken any of the tests.