I have the following dataframe
Date_x BNF Chapter_x VTM_NM Occurance_x Date_y BNF Chapter_y Occurance_y
0 2016-12-01 1 Not Specified 2994 2015-12-01 1 3212
1 2016-12-01 1 Mesalazine 2543 2015-12-01 1 2397
2 2016-12-01 1 Omeprazole 2307 2015-12-01 1 2370
3 2016-12-01 1 Esomeprazole 1535 2015-12-01 1 1516
4 2016-12-01 1 Lansoprazole 1511 2015-12-01 1 1547
I have plotted a bar chart with 2 bars one representing 2015 and the other 2016 using this code
fig = plt.figure() # Create matplotlib figure
ax = fig.add_subplot(111) # Create matplotlib axes
width = 0.4
df.Occurance_x.plot(kind='bar', color='red', ax=ax, width=width, position=1)
df.Occurance_y.plot(kind='bar', color='blue', ax=ax, width=width, position=0)
ax.set_ylabel('Occurance')
plt.legend(['Date_x', 'Date_y'], loc='upper right')
ax.set_title('BNF Chapter 1 Top 5 drugs prescribed')
plt.show()
However the x axi shows the index 0 1 2 3 4
- I want it to show the drug names
How would I go about doing this?