title: How to calculate monthly normals?
body: <p>I have this df:</p>
  <pre><code>            CODE    TMAX  TMIN   PP
  DATE                              
  1991-01-01  000130  32.6  23.4  0.0
  1991-01-02  000130  31.2  22.4  0.0
  1991-01-03  000130  32.0   NaN  0.0
  1991-01-04  000130  32.2  23.0  0.0
  1991-01-05  000130  30.5  22.0  0.0
             ...   ...   ...  ...
  2020-12-27  158328   NaN   NaN  NaN
  2020-12-28  158328   NaN   NaN  NaN
  2020-12-29  158328   NaN   NaN  NaN
  2020-12-30  158328   NaN   NaN  NaN
  2020-12-31  158328   NaN   NaN  NaN
  </code></pre>
  <p>I have data of 30 years (1991-2020) for each CODE, and i want to calculate monthly normals of TMAX, TMIN and PP. So for TMAX and TMIN i should calculate the average for every month, so if January have 31 days i should get the mean of those 31 values and get a value for January 1991, January 1992, etc. So i will have 30 Januarys (January 1991, January 1992, ... ,January 2020), 30 Februarys, etc. After this i should calculate the average of every group of months (Januarys with Januarys, Februarys with Februarys, etc). So i will have 12 values (one value for every month). Example:
  (January1991 + January1992 + ..... + January 2020) /30
  (February1991 + February1992 + ..... + February 2020) /30
  .... same for every group of months.</p>
  <p>So i'm using this code but i don't know if it's ok.</p>
  <pre><code>from datetime import date
  normalstemp=df[['CODE','TMAX','TMIN']].groupby([df.CODE, df.index.month]).mean().round(1)
  </code></pre>
  <p>For PP (precipitation) i should sum the values of every PP value of the month, so if January have 31 days i should sum all of their values and get a value for January 1991, January 1992, etc. So i will have 30 Januarys (January 1991, January 1992, ... ,January 2020) , 30 Februarys (February 1991, February 1992, ... ,February 2020), etc. After this i should calculate the average of every group of months (Januarys with Januarys, Februarys with Februarys, etc). So i will have 12 values (one value for every month, the same as TMAX and TMIN).</p>
  <p>Example:
  (January1991 + January1992 + ..... + January 2020) /30
  (February1991 + February1992 + ..... + February 2020) /30
  .... same for every group of months.</p>
  <p>So im using this code but i know this code isn't correct because i'm not getting the mean of the januarys, februarys, etc.</p>
  <pre><code>normalspp=df[['CODE','PP']].groupby([df.CODE, df.index.month]).sum().round(1)
  </code></pre>
  <p>I only have basic knowledge of python so i will appreciate if you can help me.</p>
  <p>Thanks in advance.</p>