title: Error when resample dataframe with python
body: <p>I create a dataframe </p>
  
  <pre><code>df5 = pd.read_csv('C:/Users/Demonstrator/Downloads/Listeequipement.csv',delimiter=';', parse_dates=[0], infer_datetime_format = True)
  df5['TIMESTAMP'] = pd.to_datetime(df5['TIMESTAMP'], '%d/%m/%y %H:%M')
  df5['date'] = df5['TIMESTAMP'].dt.date
  df5['time'] = df5['TIMESTAMP'].dt.time
  date_debut = pd.to_datetime('2015-08-01 23:10:00')
  date_fin = pd.to_datetime('2015-10-01 00:00:00')
  df5 = df5[(df5['TIMESTAMP'] &gt;= date_debut) &amp; (df5['TIMESTAMP'] &lt; date_fin)]
  df5.info()
  &lt;class 'pandas.core.frame.DataFrame'&gt;
  Int64Index: 8645 entries, 145 to 8789
  Data columns (total 9 columns):
  TIMESTAMP                 8645 non-null datetime64[ns]
  ACT_TIME_AERATEUR_1_F1    8645 non-null float64
  ACT_TIME_AERATEUR_1_F3    8645 non-null float64
  ACT_TIME_AERATEUR_1_F5    8645 non-null float64
  ACT_TIME_AERATEUR_1_F6    8645 non-null float64
  ACT_TIME_AERATEUR_1_F7    8645 non-null float64
  ACT_TIME_AERATEUR_1_F8    8645 non-null float64
  date                      8645 non-null object
  time                      8645 non-null object
  dtypes: datetime64[ns](1), float64(6), object(2)
  memory usage: 675.4+ KB
  </code></pre>
  
  <p>I try to resample it per day like this : </p>
  
  <pre><code>df5.index = pd.to_datetime(df5.index)
  df5 = df5.set_index('TIMESTAMP')
  df5 = df5.resample('1d').mean()
  </code></pre>
  
  <p>But I get a problem : </p>
  
  <blockquote>
  <pre><code>KeyError                                  Traceback (most recent call last)
  C:\Users\Demonstrator\Anaconda3\lib\site-packages\pandas\indexes\base.py
  </code></pre>
    
    <p>in get_loc(self, key, method, tolerance)
           1944             try:
        -> 1945                 return self._engine.get_loc(key)
           1946             except KeyError:</p>
  
  <pre><code>pandas\index.pyx in pandas.index.IndexEngine.get_loc (pandas\index.c:4154)()
  
  pandas\index.pyx in pandas.index.IndexEngine.get_loc (pandas\index.c:4018)()
  
  pandas\hashtable.pyx in pandas.hashtable.PyObjectHashTable.get_item
  </code></pre>
    
    <p>(pandas\hashtable.c:12368)()</p>
  
  <pre><code>pandas\hashtable.pyx in pandas.hashtable.PyObjectHashTable.get_item
  </code></pre>
    
    <p>(pandas\hashtable.c:12322)()</p>
  
  <pre><code>KeyError: 'TIMESTAMP'
  
  During handling of the above exception, another exception occurred:
  
  KeyError                                  Traceback (most recent call last)
  &lt;ipython-input-109-bf3238788c3e&gt; in &lt;module&gt;()
        1 df5.index = pd.to_datetime(df5.index)
  ----&gt; 2 df5 = df5.set_index('TIMESTAMP')
        3 df5 = df5.resample('1d').mean()
  
  C:\Users\Demonstrator\Anaconda3\lib\site-packages\pandas\core\frame.py
  </code></pre>
    
    <p>in set_index(self, keys, drop, append, inplace, verify_integrity)
           2835                 names.append(None)
           2836             else:
        -> 2837                 level = frame[col]._values
           2838                 names.append(col)
           2839                 if drop:</p>
  
  <pre><code>C:\Users\Demonstrator\Anaconda3\lib\site-packages\pandas\core\frame.py
  </code></pre>
    
    <p>in <strong>getitem</strong>(self, key)
           1995             return self._getitem_multilevel(key)
           1996         else:
        -> 1997             return self._getitem_column(key)
           1998 
           1999     def _getitem_column(self, key):</p>
  
  <pre><code>C:\Users\Demonstrator\Anaconda3\lib\site-packages\pandas\core\frame.py
  </code></pre>
    
    <p>in _getitem_column(self, key)
           2002         # get column
           2003         if self.columns.is_unique:
        -> 2004             return self._get_item_cache(key)
           2005 
           2006         # duplicate columns &amp; possible reduce dimensionality</p>
  
  <pre><code>C:\Users\Demonstrator\Anaconda3\lib\site-packages\pandas\core\generic.py
  </code></pre>
    
    <p>in _get_item_cache(self, item)
           1348         res = cache.get(item)
           1349         if res is None:
        -> 1350             values = self._data.get(item)
           1351             res = self._box_item_values(item, values)
           1352             cache[item] = res</p>
  
  <pre><code>C:\Users\Demonstrator\Anaconda3\lib\site-packages\pandas\core\internals.py
  </code></pre>
    
    <p>in get(self, item, fastpath)
           3288 
           3289             if not isnull(item):
        -> 3290                 loc = self.items.get_loc(item)
           3291             else:
           3292                 indexer = np.arange(len(self.items))[isnull(self.items)]</p>
  
  <pre><code>C:\Users\Demonstrator\Anaconda3\lib\site-packages\pandas\indexes\base.py
  </code></pre>
    
    <p>in get_loc(self, key, method, tolerance)
           1945                 return self._engine.get_loc(key)
           1946             except KeyError:
        -> 1947                 return self._engine.get_loc(self._maybe_cast_indexer(key))
           1948 
           1949         indexer = self.get_indexer([key], method=method, tolerance=tolerance)</p>
  
  <pre><code>pandas\index.pyx in pandas.index.IndexEngine.get_loc (pandas\index.c:4154)()
  
  pandas\index.pyx in pandas.index.IndexEngine.get_loc (pandas\index.c:4018)()
  
  pandas\hashtable.pyx in pandas.hashtable.PyObjectHashTable.get_item
  </code></pre>
    
    <p>(pandas\hashtable.c:12368)()</p>
  
  <pre><code>pandas\hashtable.pyx in pandas.hashtable.PyObjectHashTable.get_item
  </code></pre>
    
    <p>(pandas\hashtable.c:12322)()</p>
  
  <pre><code>KeyError: 'TIMESTAMP'
  </code></pre>
  </blockquote>
  
  <p>Any idea please to help me to resolve this problem?</p>
  
  <p>Kind regards</p>