Pandas, filter max values by row and columns
<p>I have this dataframe.</p>

<pre><code>In [6]: df
Out[6]:
    Beam  Pos Comb   As  
0    B1    1    1    3          
1    B1    1    1    2          
2    B1    2    1    5          
3    B1    2    1    8          
4    B1    1    2    10         
5    B1    1    2    1         
6    B1    2    2    3          
7    B1    2    2    2
8    B2    1    1    1          
9    B2    1    1    2          
10   B2    2    1    5          
11   B2    2    1    6          
12   B2    1    2    8         
13   B2    1    2    1         
14   B2    2    2    3          
15   B2    2    2    2           
</code></pre>

<p>I need to get the max value per beam and position searching in diferent combinations.</p>

<pre><code>    Beam  Pos Comb   As
0    B1    1    2    10         
1    B1    2    1    8         
2    B2    1    2    8          
3    B2    2    1    6  
</code></pre>

<p>I can't figured out how can I compare the "As" values for Beam, position and combination.</p>

<p>Perhaps grouping the beam, the positions and then get the max value?</p>

<p>Any help will be appreciated     </p>

<p>You should be using the native pandas functions instead of recreating the wheel to make this extremely simple and easy to remember:</p>

<pre><code>df.groupby(['Beam', 'Pos', 'Comb']).max()
</code></pre>

python pandas filter group