title: Convert index to datetime in pandas
body: <p>I am trying to convert the index of a Pandas dataframe to datetime using the to_datetime() method but I get an exception.</p>
  
  <p>For a toy reproducible example:</p>
  
  <p>My data:</p>
  
  <p><a href="https://i.stack.imgur.com/PIz3q.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/PIz3q.jpg" alt="enter image description here"></a></p>
  
  <p>In json format:</p>
  
  <pre><code>'{"0":{"Id":1,"Name":"Lewis Alexander","Organization":"Nomura Securities International","Dec 2018":3.25,"June 2019":3.25,"Dec 2019":3.0,"June 2020":3.0,"Dec 2020":2.88},"1":{"Id":2,"Name":"Scott Anderson","Organization":"Bank of the West","Dec 2018":3.19,"June 2019":3.5,"Dec 2019":3.47,"June 2020":3.1,"Dec 2020":2.6},"2":{"Id":3,"Name":"Paul Ashworth","Organization":"Capital Economics","Dec 2018":3.25,"June 2019":3.0,"Dec 2019":2.5,"June 2020":2.25,"Dec 2020":2.25},"3":{"Id":4,"Name":"Daniel Bachman","Organization":"Deloitte LP","Dec 2018":3.2,"June 2019":3.4,"Dec 2019":3.5,"June 2020":3.6,"Dec 2020":3.7},"4":{"Id":5,"Name":"Bernard Baumohl","Organization":"Economic Outlook Group","Dec 2018":3.1,"June 2019":3.35,"Dec 2019":3.6,"June 2020":3.9,"Dec 2020":4.2}}'
  </code></pre>
  
  <p>When I try:</p>
  
  <pre><code>df3.index.to_datetime()
  </code></pre>
  
  <p>I get the following error message:</p>
  
  <pre><code>---------------------------------------------------------------------------
  AttributeError                            Traceback (most recent call last)
  &lt;ipython-input-53-5ff789e24651&gt; in &lt;module&gt;()
  ----&gt; 1 df3.index.to_datetime()
  
  AttributeError: 'Index' object has no attribute 'to_datetime'
  </code></pre>