I've started learning pandas and have found an issue which I can't seem to resolve. I am loading a data from a csv file and need to delete some rows matching a few strings.
CSV:
id fullname city tst
999 bbb CIT aaa
888 bbb CIT aaa
777 xxx JJJ aaa
What I've tried:
import pandas as pd
df = pd.read_csv('zzz.csv')
#to_drop = ['xxx', 'aaa']
df = df.drop('xxx',axis=0)
but I am getting the error below:
KeyError: "['xxx'] not found in axis"
What I am missing here? Also, what if I want to pass a list and delete all rows matching strings from the list? Example:
to_drop = ['xxx', 'aaa']
df = df.drop(to_drop,axis=0)