SettingWithCopyWarning after df[df.a > 0]['b'] = 1 leaves the DataFrame unchanged
I am seeing SettingWithCopyWarning on a line like df[df.a > 0]['b'] = 1 , and the target column in df is not actually updated afterward. The pandas documentation describes this as chained assignment: __getitem__ may return a copy rather than a view, so __setitem__ lands on a temporary object. What I cannot pin down is how deterministic this behavior is su