QST: Misleading SettingWithCopyWarning
when assigning on result of DataFrame.dropna?
#39448
Closed
2 tasks done
Labels
I have searched the [pandas] tag on StackOverflow for similar questions.
I have asked my usage related question on StackOverflow.
Under certain cases, doing an assignment on a DataFrame created using
.dropna()
emits the infamousSettingWithCopyWarning
. So I followed what this SO answer suggests, and inspected the._is_view
and._is_copy
attributes:However, this
_is_copy
is set to None if you actually call.copy()
(misleading variable name?), which on the other hand removes the warning:But, finally,
.fillna
result does have_is_copy
set toNone
:Can anybody explain what's the meaning of the
SettingWithCopyWarning
in this context and why do I still get despite_is_view
beingFalse
in all cases?I am particularly worried about this, in light of what the pandas docs say:
Originally asked at https://stackoverflow.com/q/65926892/554319
The text was updated successfully, but these errors were encountered: