Last active
March 23, 2022 01:22
-
-
Save jonathanmc/aa5e0f5236c1ee4faaac9cf79472272b to your computer and use it in GitHub Desktop.
TWINT
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Once you have pulled a JSON of tweets with TWINT, you can use this to plot per day. | |
# You need to feed it the file_to_open variable. | |
file_to_open = "FILENAME WITHOUT EXTENSION" | |
import nest_asyncio | |
from pandas.core.frame import DataFrame | |
# pandas to read our JSON/CSV file | |
import pandas as pd | |
# load file into dataframe df | |
dforig = pd.read_json(file_to_open + '.json', lines = True) | |
df = dforig | |
df.dropna(inplace = True) # drop null values to avoid errors | |
# graph posts per day | |
import matplotlib.pyplot as plt | |
df = dforig | |
df['date'].value_counts().plot() | |
plt.show() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment