Xarray's new SeasonResampler can do this:
import xarray as xr from xarray.groupers import SeasonResampler ds = xr.tutorial.open_dataset('air_temperature') ds.resample(time=SeasonResampler(["ONDJ"])).mean()