Grouping by more than one variable

I would like to compute sums per month and year (so 1/2012, 2/2012, ..., 12/2012, 1/2013, 2/2013, etc.). In pandas, something like groupby(['month', 'year']) would be possible. It seems that 

cdstoolbox.cube.groupby_reduce does not support grouping by more than one variable. Is there any workaround for this issue?

Hi Georg,

ct.cube.groupby_reduce only takes one group at a time for example:

ct.cube.groupby_reduce(data, group='time.month', dim='time', how='sum')

What you are interested in might be ct.cube.resample:

ct.cube.resample(data, freq='month', dim='time', how='sum')

The output data still has the dimension time, one timestamp for each month in the dataset (10 years of data resampled monthly will have 10 * 12 = 120 timestamps)

Thank you Vivien,

resample is a good solution for my use case.