-
-
Notifications
You must be signed in to change notification settings - Fork 18.6k
BUG: DataFrame._item_cache not cleared on on .copy() #33299
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 5 commits
2ae7656
de867c0
d2b9181
441a3e0
dfc63dc
f1bafef
0dc971a
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 |
---|---|---|
@@ -0,0 +1,21 @@ | ||
from pandas import DataFrame | ||
import pandas._testing as tm | ||
|
||
|
||
class TestCopy: | ||
def test_cache_on_copy(self): | ||
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. put this in pandas/tests/frame/methods/test_api with the rest of the copy tests. 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. I only see other copy tests in pandas/tests/frame/test_api.py. I'll assume you mean that one. 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. yes 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. add the issue number as a comment as well as a 1-line expl |
||
df = DataFrame({"a": [1]}) | ||
|
||
df["x"] = [0] | ||
df["a"] | ||
|
||
df.copy() | ||
|
||
df["a"].values[0] = -1 | ||
|
||
tm.assert_frame_equal(df, DataFrame({"a": [-1], "x": [0]})) | ||
|
||
df["y"] = [0] | ||
|
||
assert df["a"].values[0] == -1 | ||
tm.assert_frame_equal(df, DataFrame({"a": [-1], "x": [0], "y": [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.
can you elaborate on what the user affects are here.