title: Pandas: How do I get the key (index) of the first and last row of a dataframe
body: <p>I have a dataframe (df) with a datetime index and one field &quot;myfield&quot;</p>
  <p>I want to find out the first and last datetime of the dataframe.</p>
  <p>I can access the first and last dataframe element like this:</p>
  <pre><code>df.iloc[0]
  df.iloc[-1]
  </code></pre>
  <p>for <code>df.iloc[0]</code> I get the result:</p>
  <blockquote>
  <p>myfield         myfieldcontent</p>
  <p>Name: 2017-07-24 00:00:00, dtype: float</p>
  </blockquote>
  <p>How can I access the datetime of the row?</p>