-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
TST: Add a test for multiindex df with na value and adding a new row #53010
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
Hi, |
pandas/tests/test_multilevel.py
Outdated
) | ||
df.set_index(["pivot_0", "pivot_1"], inplace=True) |
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.
) | |
df.set_index(["pivot_0", "pivot_1"], inplace=True) | |
).set_index(["pivot_0", "pivot_1"]) |
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.
May I ask what benefit do we gain from chaining the operations?
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.
We want to avoid inplace=True
where possible
pandas/tests/test_multilevel.py
Outdated
|
||
df.at[("A", "F"), "col_2"] = 0.0 | ||
|
||
assert df.loc[("A", "F")]["col_2"] == 0.0 |
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.
Instead of these assert
s, could you construct expected = DataFrame(...)
and then use tm.assert_frame_equal(df, expected)
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.
Yes. I understand that with your suggestion it would be easier to understand the expected output.
Thanks @shteken |
…pandas-dev#53010) * add test_multiindex_with_na * address comments in pr
…pandas-dev#53010) * add test_multiindex_with_na * address comments in pr
…pandas-dev#53010) * add test_multiindex_with_na * address comments in pr
doc/source/whatsnew/vX.X.X.rst
file if fixing a bug or adding a new feature.