You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
this is a correct warning (though the message in this case is a bit inapplicable).
You are in fact setting a copy.
You prob don't care; it is mainly to address situations like:
df['foo'][0] = 123... which sets the copy (and thus is not visible to the user)
This operation, make the df now point to a copy of the original
df = df [df['column2']!=8]
If you don't care about the 'original' frame, then its ok
If you are expecting that the
df['column1'] = df['columns'] + 'c'
would actually set the original frame (they are both called 'df' here which is confusing)
then you would be suprised.
You can completly turn off this warning by setting pd.set_option('chained_assignement',None)
(this warning is mainly for new users to avoid setting the copy)
or you could do:
df.is_copy = False (after the indexing operation)
Note that when you have the same index as the original frame, this DOES NOT create a copy, so no warning is generated, it is only because of the indexing which ultimately calls take which causes a copy.
Copies don't normally matter except when you are then trying to set them in a chained manner.
Hi,
I get a SettingWithCopyWarning for string manipulation in dataframes with a non-monotonic index.
This only happens if the integer index skips a value. The code to reproduce:
NB: this only happens after a fresh login into python; if you run it again, it will not appear any more (!)
System:
Is this is an actual issue or just a nonsensical warning?
Kind regards,
Egle
The text was updated successfully, but these errors were encountered: