TypeError for bar plot with custom date range
<p>I'm attempting to display a dataframe as a bar graph with a custom date range for <code>xlim</code>. I'm able to output a graph if I select <code>kind='line'</code> but I get the following error message when attempting <code>kind='bar'</code>: </p>

<pre><code>TypeError: ufunc 'isfinite' not supported for the input types, and the inputs could not be safely coerced to any supported types according to the casting rule ''safe''
</code></pre>

<p>the dataframe looks as follows:</p>

<pre><code>df1 = 
     Date         Quantity
0    2010-01-01   1  
1    2010-01-02   0
2    2010-01-03   0
3    2010-01-04   2
4    2010-01-05   3
5    2010-01-06   1
6    2010-01-07   0
7    2010-01-08   1
8    2010-01-09   1
9    2010-01-10   2
10   2010-01-11   0
11   2010-01-12   5
12   2010-01-13   2
13   2010-01-14   1
14   2010-01-15   2
...
</code></pre>

<p>This works:</p>

<pre><code>df1.plot(x='Date', y='Quantity', kind='line', grid=False, legend=False, 
         xlim=['2010-01-01', '2010-01-10'], figsize=(40, 16))
</code></pre>

<p>but this doesn't</p>

<pre><code>    df1.plot(x='Date', y='Quantity', kind='bar', grid=False, legend=False, 
         xlim=['2010-01-01', '2010-01-10'], figsize=(40, 16))
</code></pre>

<p>Yet if I remove <code>xlim</code> from <code>kind='bar'</code> I produce an output. It would be nice to be able to output a bar graph with a custom x range.</p>

<p>What about an alternative approach - filtering your data <strong>before</strong> plotting?</p>

<pre><code>In [10]: df.set_index('Date').ix['2010-01-01' : '2010-01-10']
Out[10]:
            Quantity
Date
2010-01-01         1
2010-01-02         0
2010-01-03         0
2010-01-04         2
2010-01-05         3
2010-01-06         1
2010-01-07         0
2010-01-08         1
2010-01-09         1
2010-01-10         2

In [11]: df.set_index('Date').ix['2010-01-01' : '2010-01-10', 'Quantity'].plot.bar(grid=False, legend=False)
</code></pre>

python pandas matplotlib plot dataframe