pandas 2.2 keeps throwing SettingWithCopyWarning on a simple filter
On pandas 2.2.1 / Python 3.11 I'm filtering a dataframe then setting a column and getting SettingWithCopyWarning every time. Code is basically df = df[df.status == 'active'] then df['flag'] = 1. I've read the docs twice and tried .copy() in a few places but the warning comes back as soon as I chain another filter. Production logs are getting spammed. What's the actual right way to do this in 2.2?
3 replies