Pandas Plot Returning Bar Graph with Separated Axis

  bar-chart, pandas, python

I am trying to plot a graph, but my x axis is not combining. The x axis should be just male and female, but there is a separate bar for every entry. How can I fix this? Thank you in advance!
”’
letters = list(string.ascii_uppercase)
numbers = list(range(0, 26))
fields = dict(zip(letters, numbers))

df = pd.read_csv(file_name)
cols = list(df.columns) 
title = file_name[:-3]

x_axis = cols[fields[horiz]] 
y_axis = cols[fields[vert]]
df = df.sort_values(y_axis, ascending=False)

df.plot(title=title, legend=False, x=x_axis, y=y_axis, kind="bar")


plt.xlabel(x_axis)
plt.ylabel(y_axis) 
plt.show()
'''

Source: Python Questions

LEAVE A COMMENT