Skip to content

Commit

Permalink
Merge pull request #1192 from ioam/xarray_agg
Browse files Browse the repository at this point in the history
Implemented general xarray aggregate/reduce
  • Loading branch information
jlstevens authored Mar 12, 2017
2 parents 07a6752 + 32d4dc3 commit 4adfbfd
Showing 1 changed file with 2 additions and 8 deletions.
10 changes: 2 additions & 8 deletions holoviews/core/data/xarray.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 4adfbfd

Please sign in to comment.