Adding Column Headers to new pandas dataframe
<p>I am creating a new pandas dataframe from a previous dataframe using the <code>.groupby</code> and <code>.size</code> methods. </p>

<pre><code>[in] results = df.groupby(["X", "Y", "Z", "F"]).size()

[out]
    9   27/02/2016  1   N   326
    9   27/02/2016  1   S   332
    9   27/02/2016  2   N   280
    9   27/02/2016  2   S   353
    9   27/02/2016  3   N   177
</code></pre>

<p>This behaves as expected, however the result is a dataframe with no column headers. </p>

<p>This <a href="https://stackoverflow.com/questions/11346283/renaming-columns-in-pandas">SO</a> question states that the following adds column names to the generated dataframe</p>

<pre><code>[in] results.columns = ["X","Y","Z","F","Count"]
</code></pre>

<p>However, this does not seem to have any impact at all. </p>

<pre><code>[out]
        9   27/02/2016  1   N   326
        9   27/02/2016  1   S   332
        9   27/02/2016  2   N   280
        9   27/02/2016  2   S   353
        9   27/02/2016  3   N   177
</code></pre>