From 32d4dc3d7e34beab673774b570752b4a477a135e Mon Sep 17 00:00:00 2001 From: Philipp Rudiger Date: Sat, 11 Mar 2017 20:44:54 +0000 Subject: [PATCH] Implemented general xarray aggregate/reduce --- holoviews/core/data/xarray.py | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/holoviews/core/data/xarray.py b/holoviews/core/data/xarray.py index 3dddac32ce..4dbba497c3 100644 --- a/holoviews/core/data/xarray.py +++ b/holoviews/core/data/xarray.py @@ -161,14 +161,8 @@ def values(cls, dataset, dim, expanded=True, flat=True): @classmethod def aggregate(cls, dataset, dimensions, function, **kwargs): - if len(dimensions) > 1: - raise NotImplementedError('Multi-dimensional aggregation not ' - 'supported as of xarray <=0.7.2.') - elif not dimensions: - return dataset.data.apply(function) - else: - dim = dataset.get_dimension(dimensions[0], strict=True) - return dataset.data.groupby(dim.name).apply(function) + reduce_dims = [d.name for d in dataset.kdims if d not in dimensions] + return dataset.data.reduce(function, dim=reduce_dims) @classmethod