-1

I make a DataFrame as below

enter image description here

I want to plot it as countplot like this

enter image description here

where hue to be column of my dataframe

3
  • 3
    Did you try df.plot.barh()? Commented May 11, 2020 at 13:52
  • Please (a) post your data as text not as an image so that other people can easily run it locally; and (b) post some code of what you have tried. Commented May 11, 2020 at 13:54
  • 1
    Does this answer your question? Python 3.x - Horizontal bar plot Commented May 11, 2020 at 19:36

1 Answer 1

0

Not very sure what is the format of you table, if you use pd.crosstab like below, you can easily call plot.bar() to give you the plot you want:

import seaborn as sns
tab = pd.crosstab(np.random.choice(["very useful","somewhat useful","not useful"],1000),
                  np.random.choice(["test","kaggle"],1000))
tab.plot.barh()

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.