title: Pivot and rename Pandas dataframe
body: <p>I have a dataframe in the format</p>
  
  <pre><code>      Date         Datediff         Cumulative_sum
  01 January 2019       1                   5
  02 January 2019       1                   7
  02 January 2019       2                   15
  01 January 2019       2                   8
  01 January 2019       3                   13
  </code></pre>
  
  <p>and I want to pivot the column  Datediff from the dataframe such that the end result looks like</p>
  
  <pre><code>Index            Day-1    Day-2    Day-3
  01 January 2019    5        8        13
  02 January 2019    7        15
  </code></pre>
  
  <p>I have used the pivot command shuch that</p>
  
  <pre><code>pt = pd.pivot_table(df, index = "Date",
                     columns = "Datediff",
                     values = "Cumulative_sum") \
                 .reset_index() \
                 .set_index("Date"))
  </code></pre>
  
  <p>which returns the pivoted table </p>
  
  <pre><code>                   1        2         3
  01 January 2019    5        8        13
  02 January 2019    7        15
  </code></pre>
  
  <p>And I can then rename rename the columns using the loop</p>
  
  <pre><code>for column in pt:
      pt.rename(columns = {column : "Day-" + str(column)}, inplace = True)
  </code></pre>
  
  <p>which returns exactly what I want. However, I was wondering if there is a faster way to rename the columns when pivoting and get rid of the loop altogether.</p>