Group by one column and find first of two columns pandas
<p>I have one dataframe geomerge, I need to group by one column <code>grpno.</code> and select first of column <code>MaxOfcount percent</code> and first of column <code>state code</code> and display <code>grpno.</code> also. I have rename them as <code>FirstOfMaxOfState count percent</code> and <code>FirstOfstate code</code></p>

<p>My input dataframe:</p>

<pre><code>      count percent  grpno. state code  MaxOfcount percent
0          14.78       1         CA               14.78
1           0.00       2         CA                0.00
2           0.00       2         FL                0.00
3           8.80       3         CA                8.80
4           0.00       6         NC                0.00
5           0.00       5         NC                0.00
6          59.00       4         MA               59.00
</code></pre>

<p>My output dataframe:</p>

<pre><code>      FirstOfMaxOfState count percent  state pool number FirstOfstate code
0                            14.78                  1                CA
1                             0.00                  2                CA
2                             8.80                  3                CA
3                            59.00                  4                MA
4                             0.00                  5                NC
5                             0.00                  6                NC
</code></pre>

<p>Can anyone help on this?</p>