In Pandas, after groupby the grouped column is gone : <p>I have the following dataframe named ttm:</p>

<pre><code>    usersidid   clienthostid    eventSumTotal   LoginDaysSum    score
0       12          1               60              3           1728
1       11          1               240             3           1331
3       5           1               5               3           125
4       6           1               16              2           216
2       10          3               270             3           1000
5       8           3               18              2           512
</code></pre>

<p>When i do</p>

<pre><code>ttm.groupby(['clienthostid'], as_index=False, sort=False)['LoginDaysSum'].count()
</code></pre>

<p>I get what I expected (though I would've wanted the results to be under a new label named 'ratio'):</p>

<pre><code>       clienthostid  LoginDaysSum
0             1          4
1             3          2
</code></pre>

<p>But when I do</p>

<pre><code>ttm.groupby(['clienthostid'], as_index=False, sort=False)['LoginDaysSum'].apply(lambda x: x.iloc[0] / x.iloc[1])
</code></pre>

<p>I get:</p>

<pre><code>0    1.0
1    1.5
</code></pre>

<ol>
<li>Why did the labels go? I still also need the grouped need the 'clienthostid' and I need also the results of the apply to be under a label too</li>
<li>Sometimes when I do groupby some of the other columns still appear, why is that that sometimes columns disappear and sometime stays? is there a flag I'm missing that do those stuff?</li>
<li>In the example that I gave, when I did count the results showed on label 'LoginDaysSum', is there a why to add a new label for the results instead?  </li>
</ol>

<p>Thank you,</p>
