title: Indexing datetime column in pandas
body: <p>I imported a csv file in python. Then, I changed the first column to datetime format.  </p>
  
  <pre><code>datetime                  Bid32    Ask32
  
  2019-01-01 22:06:11.699  1.14587  1.14727  
  2019-01-01 22:06:12.634  1.14567  1.14707  
  2019-01-01 22:06:13.091  1.14507  1.14647  
  </code></pre>
  
  <p>I saw three ways for indexing first column.</p>
  
  <pre><code>df.index = df.datetime
  del datetime
  </code></pre>
  
  <p>or  </p>
  
  <pre><code>df.set_index('datetime', inplace=True)
  </code></pre>
  
  <p>and  </p>
  
  <pre><code>df.set_index(pd.DatetimeIndex('datetime'), inplace=True)
  </code></pre>
  
  <p>My question is about the second and third ways. Why in some sources they used <code>pd.DatetimeIndex()</code> with <code>df.set_index()</code> (like third code) while the second code was enough? </p>