Skip to content

Instantly share code, notes, and snippets.

@ssrosa
Last active December 22, 2019 04:28
Show Gist options
  • Select an option

  • Save ssrosa/98f029ee33ec65e0cc2fa971bf009eef to your computer and use it in GitHub Desktop.

Select an option

Save ssrosa/98f029ee33ec65e0cc2fa971bf009eef to your computer and use it in GitHub Desktop.
df.drop([0], axis = 0, inplace = True) #Drop column descriptors
#Index the df with datetimes
df.set_index(pd.to_datetime(df['timestamp']), inplace = True)
#Reset time zone to US Eastern time
df.index = df.index.tz_convert('US/Eastern')
#Drop unnecessary columns
df.drop(['timestamp', 'story_id'], axis = 1, inplace = True)
#Change remaining columns to int type
df = df.astype(int)
#Draw a plot of the data set
df.plot(figsize = (16,10))
plt.title('Instagram story hits over time')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment