I have this Pandas series that contains lists of countries as following:
[United States of America] 17851
[] 6288
[United Kingdom] 2238
[France] 1654
[Japan] 1356
...
[Canada, Switzerland, France] 1
[Canada, Hungary, United Kingdom] 1
[France, Germany, Italy, Romania, United Kingdom, United States of America] 1
[Germany, Russia, United Kingdom, United States of America] 1
[Germany, Serbia] 1
Name: production_countries, Length: 2390, dtype: int64
I want to iterate over it and delete any element that has United States of America
in it.
I tried:
for row in df.production_countries:
if 'United States of America' in row:
df.drop(row)
But it gives me the following keyerror:
KeyError: "['United States of America'] not found in axis"