title: Pivot Tables with Pandas
body: <p>I have the following data saved as a pandas dataframe</p>
  <pre><code>Animal Day age Food  kg  
   1      1   3   17   0.1 
   1      1   3   22   0.7
   1      2   3   17   0.8
   2      2   7   15   0.1
  </code></pre>
  <p>With <code>pivot</code> I get the following:</p>
  <pre><code>output = df.pivot([&quot;Animal&quot;, &quot;Food&quot;], &quot;Day&quot;, &quot;kg&quot;) \
             .add_prefix(&quot;Day&quot;) \
             .reset_index() \
             .rename_axis(None, axis=1)
  
  &gt;&gt;&gt; output
     Animal  Food  Day1  Day2
  0       1    17   0.1   0.8
  1       1    22   0.7   NaN
  2       2    15   NaN   0.1
  </code></pre>
  <p>However I would like to have the age column (and other columns) still included.
  It could also be possible that for animal x the value age is not always the same, then it doesn't matter which age value is taken.</p>
  <pre><code>    Animal  Food Age Day1  Day2
  0       1    17   3   0.1   0.8
  1       1    22   3   0.7   NaN
  2       2    15   7   NaN   0.1
  </code></pre>
  <p>How do I need to change the code above?</p>