Neighbourhood
Neighbourhood

Reputation: 336

Plotting the number of entries in the dataset depending on the date

I have this dataset (screen) enter image description here

  1. How to draw plot with histograms of label distribution (its only 0 or 1) based on years

  2. How to draw linear plot, where X coord is the date (year) and Y coord is the number of entries made in a given year

Thanks!

Upvotes: 0

Views: 125

Answers (1)

NHL
NHL

Reputation: 287

if your dates are stored as datetime objects, then you can use the following :

import seaborn as sns
years=df['date'].dt.year
sns.distplot(years)

For the label, you can use :

label=1#0, you choose
df_lab=df.loc['label'==label]
years_label=df_lab['date'].dt.year
sns.distplot(years_label)

Upvotes: 1

Related Questions