36  Como hago :

import pandas as pd
import matplotlib.pyplot as plt
f = "../data/002_processed/esolmet_2018.parquet"
tmx = pd.read_parquet(f)
tmx
Ib Ig Id uv To hr ws p
Fecha
2018-01-01 00:00:00 0.057 0.0 0.0 0.001 18.93 41.57 1.253 879.0692
2018-01-01 00:10:00 0.002 0.0 0.0 0.001 18.76 41.00 0.418 879.4363
2018-01-01 00:20:00 0.170 0.0 0.0 0.001 18.92 40.96 0.955 879.5181
2018-01-01 00:30:00 0.371 0.0 0.0 0.001 18.52 42.46 1.823 879.5826
2018-01-01 00:40:00 0.305 0.0 0.0 0.001 18.49 42.43 2.149 879.6826
... ... ... ... ... ... ... ... ...
2018-12-31 23:10:00 0.125 0.0 0.0 0.000 18.88 59.60 2.145 875.5595
2018-12-31 23:20:00 0.000 0.0 0.0 0.000 18.71 59.67 1.638 875.5595
2018-12-31 23:30:00 0.044 0.0 0.0 0.000 18.52 58.75 1.923 875.2889
2018-12-31 23:40:00 0.170 0.0 0.0 0.000 18.36 60.62 2.089 875.0606
2018-12-31 23:50:00 0.003 0.0 0.0 0.000 17.99 60.76 0.744 875.1424

51173 rows × 8 columns

tmx.groupby(by=[tmx.index.month, tmx.index.hour])[["To"]].mean()
To
Fecha Fecha
1 0 17.609032
1 16.852581
2 16.151613
3 15.510699
4 15.109892
... ... ...
12 19 20.902043
20 19.904570
21 19.291290
22 18.719301
23 18.224570

288 rows × 1 columns

  1. Un dia promedio de cada mes incluyendo las horas y minutos desde el inicio
  2. Un dia promedio con tooodos los datos
# import numpy as np
resumen_mensual = (
    tmx.groupby(pd.Grouper(freq="ME"))
       .agg(
           Ig_sum  = ("Ig", "sum"),          # energía/irradiación acumulada (si aplica)
           To_mean = ("To", "mean"),         # temp. media mensual
           ws_max  = ("ws", "max"),          # racha máxima
           uv_p95  = ("uv", lambda s: s.quantile(0.95))  # percentil 95 de UV
       )
       .rename_axis("Mes")
)
resumen_mensual
Ig_sum To_mean ws_max uv_p95
Mes
2018-01-31 926337.180 20.019848 8.220 13.2100
2018-02-28 994650.038 23.522289 5.536 19.3700
2018-03-31 1264863.590 25.841069 6.705 22.1785
2018-04-30 1249487.622 26.052600 16.170 22.8505
2018-05-31 1024351.873 25.793943 8.850 24.2900
2018-06-30 1133183.176 23.487846 10.480 0.0000
2018-07-31 1386001.756 20.822079 9.810 9.0310
2018-08-31 1263105.947 22.601895 5.969 0.0000
2018-09-30 1188995.082 22.765825 10.910 0.0000
2018-10-31 1075005.059 22.670980 9.180 0.0000
2018-11-30 865874.218 21.068598 4.401 0.0000
2018-12-31 929714.212 20.362943 5.847 0.0000