Skip to content

Instantly share code, notes, and snippets.

@Abhayparashar31
Created September 12, 2022 11:30
Show Gist options
  • Save Abhayparashar31/166fbada29f37cf47d1f8707ee9ced6c to your computer and use it in GitHub Desktop.
Save Abhayparashar31/166fbada29f37cf47d1f8707ee9ced6c to your computer and use it in GitHub Desktop.
def get_connectios_count_df(df):
temp = df["Connected_on"].value_counts().reset_index()
temp.rename(columns={"index": "connected_on", "Connected_on": "count"}, inplace=True)
temp['connected_on'] = pd.to_datetime(temp['connected_on'])
temp = temp.sort_values(by="connected_on", ascending=True)
return temp
def plot_timeline(df):
temp = get_connectios_count_df(df)
fig = px.line(temp, x="connected_on", y="count",
labels={
"connected_on":'Timeline',
"count":'Number of Connections'
})
return fig
plot_timeline(df)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment