I scraped some online data using Twitter scraper. I know I can filter this fairly easily using excel, and I did export the data to an xlsx. But, I want to filter using Python. I scraped data containing Hurricane Dorian
. Also, I want to filter everything that does not include the word "Bahamas"
in it. How would I do this?
Thank you!
from twitterscraper import query_tweets
import datetime as dt
import pandas as pd
begin_date = dt.date(2019, 7, 1)
end_date = dt.date(2019, 9, 9)
limit = 1000
lang = 'english'
tweets = query_tweets('Hurricane Dorian', begindate = begin_date, enddate = end_date, limit = limit, lang = lang)
df = pd.DataFrame(t.__dict__ for t in tweets)
export_excel = df.to_excel (r'C:\Users\victo\Desktop\HurricaneData.xlsx', index = None, header=True)