2

I want to plot a column information as a pie chart. How to make it?

redemption_type = redemptions['redemption_type']
redemption_type.describe()
count     641493
unique        12
top       MPPAID
freq      637145
Name: redemption_type, dtype: object

This pie chart should consist of 12 different values with their frequency.

1
  • Not a machine-learning question, kindly do not spam irrelevant tags (removed). Commented Apr 25, 2021 at 7:08

1 Answer 1

3

Here is the easiest way

redemptions['redemption_type'].value_counts().plot(kind='pie')

Here is one with plotly-express

    temp = pd.DataFrame(redemptions['redemption_type'].value_counts())
    temp.index.name = 'val'
    temp.columns = ['count']
    temp = temp.reset_index()
    temp

    fig = px.pie(temp, names='val', values='count')
    # fig.update_traces(textinfo='value') # uncomment this line if you want actual value on the chart instead of %
    fig.show()
Sign up to request clarification or add additional context in comments.

1 Comment

The plotly-express way is exactly what I need with all necessary info, Thank you!

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.