Search code examples
pythonpython-xarray

Python xarray: grouping by multiple parameters


When using the xarray package for Python 2.7, is it possible to group over multiple parameters like you can in pandas? In essence, an operation like:

data.groupby(['time.year','time.month']).mean()

if you wanted to get mean values for each year and month of a dataset.


Solution

  • Unfortunately, xarray does not support grouping with multiple arguments yet. This is something we would like to support and it would be relatively straightforward, but nobody has had the time to implement it yet (contributions would be welcome!).