I have a csv file of 20K Tweets which a column of that is the user's location. the locations are from all regions of the world but only the states of America are important for us. The screenshot of the dataset is the following:
How can I filter this file to only keep rows that their user's location is a state of America, by Python or Tableau Prep? (remove all rows that their locations are not from USA)
import pandas as pd
df = pd.DataFrame(['Usa','Australia','Asia','Africa','Europe'],columns = ['continent'])
# make a list of word you want to filter
list_ = ['Asia','Europe','Africa']
# now you can use pandas isin functionality to filter the data that you want
df.loc[df['continent'].isin(list_)]
#op
continent
2 Asia
3 Africa
4 Europe