I'm using pandas 1.5.0, and I'm getting the SettingWithCopyWarning
, for the following code:
df["data"] = df["data"].apply(clip_from_start, args=(16,))
df = df.dropna()
df[aug1_col] = df[column].map(augmentor).copy()
df[aug2_col] = df[column].map(augmentor).copy()
The other reference on this topic: How to deal with SettingWithCopyWarning in Pandas seems to indicate that using .copy
should solve the trick. But, it isn't working here.
I also tried:
df.loc[:, aug1_col] = df[column].apply(augmentor)
df.loc[:, aug2_col] = df[column].apply(augmentor)
but that didn't work either.
Is the warning in this case just bogus, or is it doing something useful?