title: Changing Column Label format from datetime to date
body: <p>I have been trying to import data from an excel file where multiple column labels are dates. The excel file headers look somewhat like this</p>
  <h2>Name 2018-08-01 2018-08-02 Amount</h2>
  <p>After importing it to a dataframe I got the column labels-</p>
  <h2>Name 2018-08-01 00:00:00 2018-08-02 00:00:00 Amount</h2>
  <p>So I wanted to remove the hours from the headings. As the dates update automatically in the excel file so I can not replace the labels using '
  df['2018-08-01 00:00:00']` I have tried renaming the columns using following code</p>
  <pre><code>df1.columns[3] =  pd.to_datetime(df1.columns[3], format='%Y-%m-%d')
  </code></pre>
  <p>However this gives the following error:</p>
  <pre><code>TypeError: Index does not support mutable operations.
  </code></pre>
  <p>I have also tried</p>
  <pre><code>df1.rename(df1.columns[3][lambda t: t.strftime('%Y-%M-%d')])
  </code></pre>
  <p>Which gives the following error</p>
  <pre><code>TypeError: 'datetime.datetime' object is not subscriptable
  </code></pre>
  <p>I am very new to Python and dataframe and I am still in the very basic stage. How do I get this done?</p>
  <hr />
  <h1>Solved</h1>
  <p>As I already know the column index I converted them from <code>datetime object</code> to
  <code>string</code>and then sliced them. I tried iteration but it was not working so this is the only way I could do it.</p>
  <pre><code>Edate=str(df1.columns[1])
  Edatep=slice(0,10,1)
  Gdate=str(df1.columns[2])
  Gdatep=slice(0,10,1)
  
  df1.columns=['Name',Edate[Edatep],Gdate[Gdatep],'Amount']
  </code></pre>