Skip to content

Instantly share code, notes, and snippets.

@abhigenie92
Created March 22, 2016 22:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save abhigenie92/b4a040f3d5267a604329 to your computer and use it in GitHub Desktop.
Save abhigenie92/b4a040f3d5267a604329 to your computer and use it in GitHub Desktop.
I want to plot the number of items in each quarter of the year. But the results are incorrect.
'incorrect'- There are more items in the earlier years plotted than later. Though analyzing the dataset it should be opposite.
df.head()
date username
0 2007-08-09 ginaemiko
1 2007-07-30 AtomAnt
2 2008-07-08 RecoveryTweet
3 2008-07-05 RecoveryTweet
4 2008-06-29 lwu
ax=df.date.groupby([df.date.dt.year, df.date.dt.quarter]).count().plot(kind="bar")
ax.set_xlabel('Time (Year, Quarter)', fontsize=16)
ax.set_ylabel('Count', fontsize=16)
plt.tight_layout()
plt.savefig('./plots/tweets_quarter.png',dpi=200)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment