Skip to main content
`Ctrl`+`K`

# pandas.errors.ChainedAssignmentError

exception pandas.errors.ChainedAssignmentError

  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.

  See also

  `DataFrame.loc`

    Access a group of rows and columns by label(s) or a boolean array.

  `DataFrame.iloc`

    Purely integer-location based indexing for selection by position.

  `Series.loc`

    Access a group of rows by label(s) or a boolean array.

  Examples

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