1

I am trying to create a histogram of education. However, my data is such that the edu variable is categorical: '10', '11', '12', 'GED', etc.. I want a histogram that goes in that order '10', '11', '12', 'GED', '13', etc.

My two approaches are:

1: Use pd.DataFrame.hist with a new variable that maps edu to a numeric edunum variable. However, I am then having trouble getting the original edu lables on the histogram

2: Use pd.Series(list(profile.['edu'])).value_counts().plot(kind="bar"). However, I am having trouble sorting the bar order correctly.

Any suggestions? Thanks!

3
  • check the link stackoverflow.com/questions/50012525/… Commented Apr 25, 2018 at 15:39
  • Ah sorry about that - didn't see that one. Asked today, too! Thanks @wen Commented Apr 25, 2018 at 16:01
  • No worry , happy coding Commented Apr 25, 2018 at 16:04

0

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.