1

I would like to visualise the percentage on the y-axis instead of values:

Date             Label
2020-12-01         1
2020-12-01         1
2020-12-01         1
2020-12-01         1
2020-12-03         1
2020-12-03         1
2020-12-04         1
2020-12-05         1

in order to have normalised values. Could you please tell me how I can do that?

1 Answer 1

1

You can pass normalize=True to value_counts and plot it:

df['Date'] = pd.to_datetime(df['Date']).dt.date
df['Date'].value_counts(normalize=True).plot(kind='bar')

enter image description here

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.