ListOfNames = ['AA', 'BA', CF']
df:
ID Name Gene Chr Info
1 DD S 3 441
2 AA S 5 444
3 DD F 3 744
4 DD VV 1 448
5 BA S 3 445
I need to delete all rows from Name same like in a list and move it to another df.
I do something like that:
newDF= pd.DataFrame()
for i in range(len(ListOfNames )):
a = df.where(df.Name == ListOfNames[i]).dropna()
newDF= newDF.append(a[0:])
In old df should stay all rows without deleted. Deleted should be move to new df. My code return empty df and I don't know why.
If I run:
a = df.where(df.Name == ListOfNames[1]).dropna()
I got normally row from df with AA name.
Why it's doesn't works?