Reputation: 657
I have this dataset:
name date
0 ramos-vinolas-sao-paulo-2017-final 2017-03-05 22:50:00
1 sao-paulo-2017-doubles-final-sa-dutra-silva 2017-03-05 19:29:00
2 querrey-acapulco-2017-trophy 2017-03-05 06:08:00
3 soares-murray-acapulco-2017-doubles-final 2017-03-05 02:48:00
4 cuevas-sao-paulo-2017-saturday 2017-03-04 21:54:00
5 dubai-2017-doubles-final-rojer-tecau2 2017-03-04 18:23:00
I'd like to build bar plot with amount of news by day/hour. Something like
count date
4 2017-03-05
2 2017-03-04
Upvotes: 1
Views: 1285
Reputation: 493
A simple approach is using the pandas function hist()
:
df["date"].hist()
Upvotes: 0
Reputation: 862471
I think you need dt.date
with value_counts
, for ploting bar
:
#if necessary convert to datetime
df['date'] = pd.to_datetime(df.date)
print (df.date.dt.date.value_counts())
2017-03-05 4
2017-03-04 2
Name: date, dtype: int64
df.date.dt.date.value_counts().plot.bar()
Upvotes: 1