Skip to content

Commit

Permalink
Update groupby.py
Browse files Browse the repository at this point in the history
  • Loading branch information
Illviljan committed Nov 6, 2021
1 parent c56dd94 commit a89f62b
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions asv_bench/benchmarks/groupby.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

import xarray as xr

from . import parameterized, requires_dask
from . import _skip_slow, parameterized, requires_dask


class GroupBy:
Expand Down Expand Up @@ -41,13 +41,23 @@ def setup(self, *args, **kwargs):


class GroupByDataFrame(GroupBy):
"""Run groupby tests using pandas DataFrame."""

def setup(self, *args, **kwargs):
# Skip testing in CI as it won't ever change in a commit:
_skip_slow()

super().setup(**kwargs)
self.ds1d = self.ds1d.to_dataframe()


class GroupByDaskDataFrame(GroupBy):
"""Run groupby tests using dask DataFrame."""

def setup(self, *args, **kwargs):
# Skip testing in CI as it won't ever change in a commit:
_skip_slow()

requires_dask()
super().setup(**kwargs)
self.ds1d = self.ds1d.chunk({"dim_0": 50}).to_dataframe()
Expand Down Expand Up @@ -75,7 +85,7 @@ def time_agg_small_num_groups(self, method, ndim):
@parameterized(["method", "ndim"], [("sum", "mean"), (1, 2)])
def time_agg_large_num_groups(self, method, ndim):
ds = getattr(self, f"ds{ndim}d")
getattr(ds.resample(time="24H"), method)()
getattr(ds.resample(time="48H"), method)()


class ResampleDask(Resample):
Expand Down

0 comments on commit a89f62b

Please sign in to comment.