python I want to set_index dateFrame with datetime
<pre><code>poorList = [datetime.date(2016, 5, 2), 
            datetime.date(2016, 8, 26), 
            datetime.date(2016, 6, 9), 
            datetime.date(2016, 3, 4)]

dateForm.set_index(poorList)
</code></pre>

<p>then it was Errorï¼</p>

<blockquote>
  <p>File "pandas\index.pyx", line 137, in pandas.index.IndexEngine.get_loc
  (pandas\index.c:4066)
         File "pandas\index.pyx", line 159, in pandas.index.IndexEngine.get_loc (pandas\index.c:3930)
         File "pandas\hashtable.pyx", line 675, in pandas.hashtable.PyObjectHashTable.get_item (pandas\hashtable.c:12408)
         File "pandas\hashtable.pyx", line 683, in pandas.hashtable.PyObjectHashTable.get_item (pandas\hashtable.c:12359)
       KeyError: datetime.date(2016, 5, 2)</p>
</blockquote>

<p>Please tell me how to do it ?</p>

<p>DataFrame.set_index() expects a column name or list of columns as an argument, so you should do:</p>

<pre><code>dateForm['date'] = poorList
dateForm.set_index('date', inplace=True)
</code></pre>

python list date pandas datetimeindex