Ch11 Figure2


In [7]:
# reuse twitter data
import json

tweets_data = []
tweets_file = open('csv_output/ch3_fig1_twitter.json', "r")
for line in tweets_file:
    try:
        tweet = json.loads(line)
        tweets_data.append(tweet)
    except:
        continue

df = pd.DataFrame()
df['text'] = list(map(lambda x: x['text'], tweets_data))
# df['text'].sum() # copy and paste this to https://www.jasondavies.com/wordcloud/ to generate the following word cloud