Home > database >  Switch the values from x-axis to y-axis while using the correct labels(Python Matplotlib.pyplot OR S
Switch the values from x-axis to y-axis while using the correct labels(Python Matplotlib.pyplot OR S

Time:11-23

I have a small table of information that I'm trying to turn into a histogram. It has one column of Department names and a second column of totals. I would like the x-axis to use the Department names and the y-axis to use the numbers from the totals column. When I try to code it, the x-axis is the totals and the y-axis is a count of how many of those totals fit into the bins.

Title: deptgroups (my dataframe)

department count
Admin 857
Engineering 26
IT 49
Marketing 16
Operations 1013
Sales 1551

Data as "datagroups.csv"

department,count,
Admin,857,
Engineering,26,
IT,49,
Marketing,16,
Operations,1013,
Sales,1551
plt.hist(x=deptgroups)
plt.show()

enter image description here

  • Related