pandas.errors.ChainedAssignmentError#

exception pandas.errors.ChainedAssignmentError[source]#

Warning raised when trying to set using chained assignment.

With Copy-on-Write now always enabled, chained assignment can never work. In such a situation, we are always setting into a temporary object that is the result of an indexing operation (getitem), which under Copy-on-Write always behaves as a copy. Thus, assigning through a chain can never update the original Series or DataFrame.

For more information on Copy-on-Write, see the user guide.

Examples

>>> df = pd.DataFrame({"A": [1, 1, 1, 2, 2]}, columns=["A"])
>>> df["A"][0:3] = 10
... # ChainedAssignmentError: ...