title: Groupby count of non NaN of another column and a specific calculation of the same columns in pandas
body: <p>I have a data frame as shown below</p>
  <pre><code>ID    Class    Score1       Score2   Name
  1     A        9            7        Xavi
  2     B        7            8        Alba
  3     A        10           8        Messi
  4     A        8            10       Neymar
  5     A        7            8        Mbappe
  6     C        4            6        Silva
  7     C        3            2        Pique
  8     B        5            7        Ramos
  9     B        6            7        Serge
  10    C        8            5        Ayala
  11    A        NaN          4        Casilas
  12    A        NaN          4        De_Gea
  13    B        NaN          2        Seaman
  14    C        NaN          7        Chilavert
  15    B        NaN          3        Courtous
  </code></pre>
  <p>From the above, I would like to calculate the number of players with scoer1 less than or equal to 6 in each Class along with count of non NaN rows (Class wise)</p>
  <p>Expected output:</p>
  <pre><code>Class     Total_Number   Count_Non_NaN    Score1_less_than_6_#    Avg_score1  
  A         6              4                0                       8.5 
  B         5              3                2                       6 
  C         4              3                2                       5
  </code></pre>
  <p>tried below code</p>
  <pre><code>df2 = df.groupby('Class').agg(Total_Number = ('Score1','size'),
                               Score1_less_than_6 = ('Score1',lambda x: x.between(0,6).sum()),
                               Avg_score1 = ('Score1','mean'))
  
  df2 = df2.reset_index()
  df2
  </code></pre>