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()
Published at
2022-12-21 19:34:12Event JSON
{
"id": "b725b2e14adb9d173b12edca632fb41746573c33a2bcaf593fc8e43ba3c1c642",
"pubkey": "5c10ed0678805156d39ef1ef6d46110fe1e7e590ae04986ccf48ba1299cb53e2",
"created_at": 1671651252,
"kind": 1,
"tags": [
[
"e",
"8e2648b5bf2a110154515b02d79350b3c78810e3ce318f70e5fc7b81beefaa39",
"",
"root"
],
[
"e",
"651c7270843fe39e8dee455321263d166fbf499bf24e04f5580ab56785f607e0",
"",
"reply"
],
[
"p",
"1f2bdd42ae4c2ae121cdfd50557e4b58ef2eb337498025e6fdf86634e197a218"
]
],
"content": "Me:\n\n# importing the libraries\nimport pandas as pd\nimport matplotlib.pyplot as plt\nfrom nostr import get_posts\n\n# get posts data\nposts = get_posts()\n\n# create a dataframe\ndf = pd.DataFrame(posts)\n\n# add hour of post column\ndf['hour_of_post'] = df['timestamp'].dt.hour\n\n# group and count posts by hour\ncounts = df.groupby('hour_of_post')['post'].count()\n\n# plot in a bar graph\nplt.bar(counts.index,counts.values)\nplt.xlabel('Hour of Post')\nplt.ylabel('No. of Posts')\nplt.show()",
"sig": "c92f50e99bfefda9f2771681d6aa7643a1de791a6d4e62d055ee49bf16b0a32e737a723ed396713e8ed147b644af6e4ce9568254acf9b8971abe814122ab0b02"
}