pandas: REGR: invalid cache after take operation with non-consolidated dataframe
a program run ok with pandas 1.0.5, but after upgrade to 1.1.0. it fail. i found sometimes when I change one cell of dataframe value, print(df) and it doesn’t change. but i use ==, it says changed. for example: original cell value is A, then i change cell value to B. A=B print df, it show still A df.at(x, x) == B, it says TRUE.
MarcoGorelli’s edit: here’s a reproducible example:
import pandas as pd
position = pd.DataFrame(columns=["code", "startdate"])
position = position.append([{"code": "a", "startdate": 0}])
# These two lines should not change anything.
# BUT, commenting either of them out makes this code run as intendeed
position["code"] == "A"
position[position["startdate"] == 0]
position.at[0, "code"] = "A"
print(position.at[0, "code"])
print(position)
output:
A
code startdate
0 a 0
expected output:
A
code startdate
0 A 0
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Comments: 22 (15 by maintainers)
@on55 I’ve removed the irrelevant parts from your report, this reproduces the issue:
output:
expected output: