Python: Plot a bar graph for a pandas data frame with x axis using a given column
<p>I want to plot a bar chart for the following pandas data frame on Jupyter Notebook. </p>

<pre><code>      | Month | number
-------------------------
    0 | Apr   |  6.5
    1 | May   |  7.3
    2 | Jun   |  3.9
    3 | Jul   |  5.1
    4 | Aug   |  4.1
</code></pre>

<p>I did:</p>

<pre><code>%matplotlib notebook
import matplotlib.pyplot as plt
import matplotlib
matplotlib.style.use('ggplot')
trend_df.plot(kind='bar')
</code></pre>

<p>How do I make sure x-axis is actually showing month here?</p>

<p>You can simply specify <code>x</code> and <code>y</code> in your call to <code>plot</code> to get the bar plot you want.</p>

<pre><code>trend_df.plot(x='Month', y='number', kind='bar')
</code></pre>

<p><a href="http://i.stack.imgur.com/KOJnc.png" rel="nofollow"><img src="http://i.stack.imgur.com/KOJnc.png" alt="enter image description here"></a></p>

<p>Given <code>trend_df</code> as</p>

<pre><code>In [20]: trend_df
Out[20]: 
  Month  number
0   Apr     6.5
1   May     7.3
2   Jun     3.9
3   Jul     5.1
4   Aug     4.1
</code></pre>

python pandas jupyter-notebook python-ggplot