-
-
Notifications
You must be signed in to change notification settings - Fork 18.6k
TST: Test Loc to set Multiple Items to multiple new columns #42665
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
Thanks @GYvan for the PR. There are some lint failures and another git commit. see https://pandas.pydata.org/pandas-docs/dev/development/contributing.html#working-with-the-code |
Thanks, I will look through them |
|
|
Hi @simonjayhawkins. I have tried to address the lint failures and reverted the unrelate changes. Can you please let me know if anything else needs changes? |
cc @phofl |
pandas/tests/indexing/test_loc.py
Outdated
expected.loc[1, "b"] = 6 | ||
expected.loc[1, "c"] = 7 | ||
|
||
tm.assert_frame_equal(result, expected, check_dtype=False) |
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.
does this fail w/o the check_dtype?
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, as it should. The expected should have dtype object while df has dtype float in these columns
pandas/tests/indexing/test_loc.py
Outdated
# GH 25594 | ||
df = DataFrame(index=[1, 2], columns=["a"]) | ||
df.loc[1, ["b", "c"]] = [6, 7] | ||
result = df.copy() |
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.
No result needed, just use df
pandas/tests/indexing/test_loc.py
Outdated
df.loc[1, ["b", "c"]] = [6, 7] | ||
result = df.copy() | ||
|
||
expected = DataFrame(index=[1, 2], columns=["a", "b", "c"]) |
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.
Please define expected without the use of loc. You can show the result of the sequential operations too, but please use another check for this
… and linting addresssed
… Made and pre-commit
pandas/tests/indexing/test_loc.py
Outdated
|
||
tm.assert_frame_equal(result, expected, check_dtype=False) | ||
tm.assert_frame_equal(df, expected, check_dtype=False) |
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.
Please remove the check_dtype=False parameter
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.
@phofl I tried the remove the "check_dtype=False" parameter put the test is not passing. This is the error I'm getting: "- AssertionError: Attributes of DataFrame.iloc[:, 0] (column name="a") are different". I think the dtype of df and expected are different
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.
Then you have to define expected accordingly
lgtm. @phofl merge when ready |
Thanks @GYvan |
…ev#42665) * Modified ecosystem.rst to include ibis * created a test for issue pandas-dev#25594 * Test for issue pandas-dev#25594 * reverted the changes * Test Loc to set Multiple Items to multiple new columns - Changes Made * Test Loc to set Multiple Items to multiple new columns - Changes made and linting addresssed * TST: Test Loc to set Multiple Items to multiple new columns - Changes Made and pre-commit * TST: test for issue pandas-dev#25594 - Changes made * removed the check_dtype
…ev#42665) * Modified ecosystem.rst to include ibis * created a test for issue pandas-dev#25594 * Test for issue pandas-dev#25594 * reverted the changes * Test Loc to set Multiple Items to multiple new columns - Changes Made * Test Loc to set Multiple Items to multiple new columns - Changes made and linting addresssed * TST: Test Loc to set Multiple Items to multiple new columns - Changes Made and pre-commit * TST: test for issue pandas-dev#25594 - Changes made * removed the check_dtype
added test to pandas/tests/indexing/multi/test_loc.py