Chaining of consecutive and separate index operations with Python-pandas objects.
Chained assignment (or chained indexing) as it relates to pandas indexing is a chaining of consecutive and separate index operations, where successive index operations are done on a copy of a portion of the result from the first operation.
Assignment with chained indexing will generate a SettingWithCopyWarning
and should be generally be avoided. However, there are a minority of instances where the warning can be safely ignored. For these situations consider using:
with pd.option_context('mode.chained_assignment', None):
# Code inside this `with` block will not issue the warning
For more see:
- The pandas docs: Returning a View Versus a Copy; Getting and Setting Options
- dataquest.io: Understanding SettingwithCopyWarning in pandas.