-
-
Notifications
You must be signed in to change notification settings - Fork 19.1k
BUG: Fix empty MultiIndex DataFrame xlsx export #57697
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 1 commit
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 |
---|---|---|
|
@@ -936,6 +936,17 @@ def test_to_excel_empty_multiindex(self, tmp_excel): | |
result, expected, check_index_type=False, check_dtype=False | ||
) | ||
|
||
def test_to_excel_empty_multiindex_both_axes(self, tmp_excel): | ||
# GH 57696 | ||
df = DataFrame( | ||
[], | ||
index=MultiIndex.from_tuples([], names=[0, 1]), | ||
columns=MultiIndex.from_tuples([("A", "B")]), | ||
) | ||
df.to_excel(tmp_excel) | ||
result = pd.read_excel(tmp_excel, header=None) | ||
assert result.iloc[:2, -1].to_list() == ["A", "B"] | ||
|
||
|
||
def test_to_excel_float_format(self, tmp_excel): | ||
df = DataFrame( | ||
[[0.123456, 0.234567, 0.567567], [12.32112, 123123.2, 321321.2]], | ||
|
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.
I believe
ExcelFormatter
is private; can you change to to:meth:`DataFrame.to_excel`