-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
BUG: Inconsistent conversion of missing column names #44878
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
0959372
276bdff
8a4879a
10bcdc4
e2a1247
aa6374a
b2c4b92
a6c2109
314b777
c2d9668
94a86a0
4f569ad
f311e49
122eecd
ac573b8
76e864b
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 |
---|---|---|
|
@@ -604,3 +604,10 @@ def is_builtin_func(arg): | |
otherwise return the arg | ||
""" | ||
return _builtin_table.get(arg, arg) | ||
|
||
|
||
def fill_missing_names(names): | ||
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. can you type in and out here 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. Done, and added version and more docstring. |
||
""" | ||
If a name is missing then replace it by level_n, where n is the count | ||
""" | ||
return [f"level_{i}" if name is None else name for i, name in enumerate(names)] |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -91,7 +91,7 @@ def test_to_records_index_name(self): | |
df.index = MultiIndex.from_tuples([("a", "x"), ("a", "y"), ("b", "z")]) | ||
df.index.names = ["A", None] | ||
rs = df.to_records() | ||
assert "level_0" in rs.dtype.fields | ||
assert "level_1" in rs.dtype.fields | ||
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. Could you maybe add a test checking the whole result? 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. Cruel! But done. |
||
|
||
def test_to_records_with_unicode_index(self): | ||
# GH#13172 | ||
|
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.
Could you specify a bit more?
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