title: KeyError when trying to plot or histogram pandas data in matplotlib
body: <p>I'm having a problem with generating a basic distribution histogram from an imported csv file. The code works for one set of data from another csv, but not the one that I am interested in, that is essentially the same. Here is the code I've tried:</p>
  
  <pre><code>import pandas as pd
  import numpy as np
  import matplotlib as plt
  data = pd.read_csv("idcases.csv")
  data1 = data[(data["Disease"] == "Amebiasis") &amp; (data["County"] == "Marin")]
  data2 = data[(data["Disease"] == "Amebiasis") &amp; (data["County"] == "Sonoma")]
  
  fig = plt.pyplot.figure()
  ax = fig.add_subplot(111)
  ax.hist(data1['Population'], bins =10, range = (data1['Population'].min(), data1['Population'].max()))
  plt.pyplot.xlabel('Population')
  plt.pyplot.ylabel('Count of Population')
  plt.pyplot.show()
  </code></pre>
  
  <p>Which yields:</p>
  
  <pre><code>---------------------------------------------------------------------------
  KeyError                                  Traceback (most recent call last)
  &lt;ipython-input-35-63303aa9d8a5&gt; in &lt;module&gt;()
        1 fig = plt.pyplot.figure()
        2 ax = fig.add_subplot(111)
  ----&gt; 3 ax.hist(data1['Population'], bins =10, range = (data1['Population'].min(), data1['Population'].max()))
    4 plt.pyplot.xlabel('Count')
    5 plt.pyplot.ylabel('Count of Population')
  
  C:\Program Files (x86)\Anaconda\lib\site-packages\matplotlib\axes\_axes.py in hist(self, x, bins, range, normed, weights, cumulative, bottom, histtype, align, orientation, rwidth, log, color, label, stacked, **kwargs)
     5602         # Massage 'x' for processing.
     5603         # NOTE: Be sure any changes here is also done below to 'weights'
  -&gt; 5604         if isinstance(x, np.ndarray) or not iterable(x[0]):
     5605             # TODO: support masked arrays;
     5606             x = np.asarray(x)
  
  C:\Program Files (x86)\Anaconda\lib\site-packages\pandas\core\series.py in __getitem__(self, key)
      549     def __getitem__(self, key):
      550         try:
  --&gt; 551             result = self.index.get_value(self, key)
      552 
      553             if not np.isscalar(result):
  
  C:\Program Files (x86)\Anaconda\lib\site-packages\pandas\core\index.py in get_value(self, series, key)
     1721 
     1722         try:
  -&gt; 1723             return self._engine.get_value(s, k)
     1724         except KeyError as e1:
     1725             if len(self) &gt; 0 and self.inferred_type in ['integer','boolean']:
  
  pandas\index.pyx in pandas.index.IndexEngine.get_value (pandas\index.c:3204)()
  
  pandas\index.pyx in pandas.index.IndexEngine.get_value (pandas\index.c:2903)()
  
  pandas\index.pyx in pandas.index.IndexEngine.get_loc (pandas\index.c:3843)()
  
  pandas\hashtable.pyx in pandas.hashtable.Int64HashTable.get_item (pandas\hashtable.c:6525)()
  
  pandas\hashtable.pyx in pandas.hashtable.Int64HashTable.get_item (pandas\hashtable.c:6463)()
  
  KeyError: 0L
  </code></pre>
  
  <p>What am I doing wrong? Here is a part of what the data that I'm reading in looks like. The code does not work for any of the fields, including 'Count' or 'Rate'</p>
  
  <pre><code>       Disease County  Year     Sex  Count  Population   Rate  CI.lower  \
  882  Amebiasis  Marin  2001   Total     14      247731  5.651     3.090   
  883  Amebiasis  Marin  2001  Female      0      125414  0.000     0.000   
  884  Amebiasis  Marin  2001    Male      0      122317  0.000     0.000   
  885  Amebiasis  Marin  2002   Total      7      247382  2.830     1.138   
  886  Amebiasis  Marin  2002  Female      0      125308  0.000     0.000   
  887  Amebiasis  Marin  2002    Male      0      122074  0.000     0.000   
  888  Amebiasis  Marin  2003   Total      9      247280  3.640     1.664   
  889  Amebiasis  Marin  2003  Female      0      125259  0.000     0.000   
  890  Amebiasis  Marin  2003    Male      0      122021  0.000     0.000   
  </code></pre>