Movatterモバイル変換


[0]ホーム

URL:


Skip to main content
Ctrl+K

pandas.errors.ChainedAssignmentError#

exceptionpandas.errors.ChainedAssignmentError[source]#

Warning raised when trying to set using chained assignment.

When themode.copy_on_write option is enabled, chained assignment cannever work. In such a situation, we are always setting into a temporaryobject that is the result of an indexing operation (getitem), which underCopy-on-Write always behaves as a copy. Thus, assigning through a chaincan never update the original Series or DataFrame.

For more information on view vs. copy,seethe user guide.

Examples

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

[8]ページ先頭

©2009-2025 Movatter.jp