Here is how I encountered the error:
df.loc[a_list][df.a_col.isnull()]
The type of a_list
is Int64Index
, it contains a list of row indexes. All of these row indexes belong to df
.
The df.a_col.isnull()
part is a condition I need for filtering.
If I execute the following commands individually, I do not get any warnings:
df.loc[a_list]
df[df.a_col.isnull()]
But if I put them together df.loc[a_list][df.a_col.isnull()]
, I get the warning message (but I can see the result):
Boolean Series key will be reindexed to match DataFrame index
What is the meaning of this error message? Does it affect the result that it returned?
df.loc[a_list.tolist()]
– Mohammad Yusufdf.loc[a_list]
may not have the same length asdf.a_col.isnull()
any more which is the reason you are getting the error. – Psidom