Why Nostr? What is Njump?
2022-12-21 19:34:12
in reply to

dave on Nostr: Me: # importing the libraries import pandas as pd import matplotlib.pyplot as plt ...

Me:

# importing the libraries
import pandas as pd
import matplotlib.pyplot as plt
from nostr import get_posts

# get posts data
posts = get_posts()

# create a dataframe
df = pd.DataFrame(posts)

# add hour of post column
df['hour_of_post'] = df['timestamp'].dt.hour

# group and count posts by hour
counts = df.groupby('hour_of_post')['post'].count()

# plot in a bar graph
plt.bar(counts.index,counts.values)
plt.xlabel('Hour of Post')
plt.ylabel('No. of Posts')
plt.show()
Author Public Key
npub1tsgw6pncspg4d5u778hk63s3pls70evs4czfsmx0fzap9xwt203qtkhtk4