Skip to content

Commit

Permalink
Further test fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
philippjfr committed Dec 8, 2019
1 parent 369650d commit 92df843
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 7 deletions.
16 changes: 10 additions & 6 deletions holoviews/core/data/cudf.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,6 @@ def init(cls, eltype, data, kdims, vdims):
return data, {'kdims':kdims, 'vdims':vdims}, {}



@classmethod
def range(cls, dataset, dimension):
column = dataset.data[dataset.get_dimension(dimension, strict=True).name]
Expand Down Expand Up @@ -239,7 +238,8 @@ def select(cls, dataset, selection_mask=None, **selection):
selection_mask = cls.select_mask(dataset, selection)

indexed = cls.indexed(dataset, selection)
df = df[selection_mask]
if selection_mask is not None:
df = df[selection_mask]
if indexed and len(df) == 1 and len(dataset.vdims) == 1:
return df[dataset.vdims[0].name].iloc[0]
return df
Expand All @@ -266,14 +266,18 @@ def aggregate(cls, dataset, dimensions, function, **kwargs):
vdims = dataset.dimensions('value', label='name')
reindexed = data[cols+vdims]
agg = function.__name__
if agg in ('amin', 'amax'):
agg = agg[1:]
if not hasattr(data, agg):
raise ValueError('%s aggregation is not supported on cudf DataFrame.' % agg)
if len(dimensions):
agg_map = {'amin': 'min', 'amax': 'max'}
agg = agg_map.get(agg, agg)
grouped = reindexed.groupby(cols, sort=False)
if not hasattr(grouped, agg):
raise ValueError('%s aggregation is not supported on cudf DataFrame.' % agg)
df = getattr(grouped, agg)().reset_index()
else:
agg_map = {'amin': 'min', 'amax': 'max', 'size': 'count'}
agg = agg_map.get(agg, agg)
if not hasattr(reindexed, agg):
raise ValueError('%s aggregation is not supported on cudf DataFrame.' % agg)
agg = getattr(reindexed, agg)()
data = dict(((col, [v]) for col, v in zip(agg.index, agg.to_array())))
df = util.pd.DataFrame(data, columns=list(agg.index))
Expand Down
3 changes: 2 additions & 1 deletion holoviews/tests/core/data/testcudfinterface.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,4 +41,5 @@ def test_dataset_sort_vdim_hm_alias(self):
def test_dataset_sort_string_ht(self):
raise SkipTest("Not supported")


def test_dataset_2D_aggregate_spread_fn_with_duplicates(self):
raise SkipTest("cuDF does not support variance aggregation")

0 comments on commit 92df843

Please sign in to comment.