I want to get rid of rows whose index isin the list ["A", "C"].
Example:
import pandas as pd
df_test = pd.DataFrame({"Col": [1,2,3,4]}, index=["A", "B", "C", "D"])
Col A 1 B 2 C 3 D 4
Now I put reassignment:
df_test = df_test[~df_test.index.isin(["A", "C"])]
I'm trying to understand the following result.
df_test._is_copy
(* <weakref at 0x11d14a4a8; to 'DataFrame' at 0x11d0dbac8> *)
why do I get
weakrefcopy here?Is it a right way to eliminate rows whose indexes are in the given list? Should I use
.loc[:,:]on the left or.copy()on the right?
