Last active
December 22, 2019 04:28
-
-
Save ssrosa/98f029ee33ec65e0cc2fa971bf009eef to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| 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