Skip to content

Commit

Permalink
Add tests and address reviews
Browse files Browse the repository at this point in the history
  • Loading branch information
galipremsagar committed Aug 17, 2021
1 parent 8e84682 commit 87c97f5
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 1 deletion.
9 changes: 9 additions & 0 deletions python/cudf/cudf/tests/test_datetime.py
Original file line number Diff line number Diff line change
Expand Up @@ -1541,3 +1541,12 @@ def test_is_quarter_end(data, dtype):
got = gs.dt.is_quarter_end

assert_eq(expect, got)


def test_error_values():
s = cudf.Series([1, 2, 3], dtype="datetime64[ns]")
with pytest.raises(
NotImplementedError,
match="DateTime Arrays is not yet implemented in cudf",
):
s.values
9 changes: 9 additions & 0 deletions python/cudf/cudf/tests/test_timedelta.py
Original file line number Diff line number Diff line change
Expand Up @@ -1386,3 +1386,12 @@ def test_timedelta_reductions(data, op, dtype):
assert True
else:
assert_eq(expected.to_numpy(), actual)


def test_error_values():
s = cudf.Series([1, 2, 3], dtype="timedelta64[ns]")
with pytest.raises(
NotImplementedError,
match="TimeDelta Arrays is not yet implemented in cudf",
):
s.values
3 changes: 2 additions & 1 deletion python/dask_cudf/dask_cudf/backends.py
Original file line number Diff line number Diff line change
Expand Up @@ -263,6 +263,8 @@ def is_categorical_dtype_cudf(obj):

@percentile_dispatch.register((cudf.Series, cp.ndarray, cudf.Index))
def percentile_cudf(a, q, interpolation="linear"):
# Cudf dispatch to the equivalent of `np.percentile`:
# https://numpy.org/doc/stable/reference/generated/numpy.percentile.html
a = cudf.Series(a)
# a is series.
n = len(a)
Expand All @@ -273,7 +275,6 @@ def percentile_cudf(a, q, interpolation="linear"):

if cudf.utils.dtypes.is_categorical_dtype(a.dtype):
result = cp.percentile(a.cat.codes, q, interpolation=interpolation)
import pandas as pd

return (
pd.Categorical.from_codes(
Expand Down

0 comments on commit 87c97f5

Please sign in to comment.