diff --git a/python/cudf/cudf/core/column/column.py b/python/cudf/cudf/core/column/column.py index b605e5c9819..1c1845373e1 100644 --- a/python/cudf/cudf/core/column/column.py +++ b/python/cudf/cudf/core/column/column.py @@ -846,10 +846,7 @@ def sort_by_values( col_keys = self.take(col_inds) return col_keys, col_inds - def distinct_count(self, method: str = "sort", dropna: bool = True) -> int: - if method != "sort": - msg = "non sort based distinct_count() not implemented yet" - raise NotImplementedError(msg) + def distinct_count(self, dropna: bool = True) -> int: try: return self._distinct_count[dropna] except KeyError: diff --git a/python/cudf/cudf/core/dataframe.py b/python/cudf/cudf/core/dataframe.py index 95370cdeff7..57d591dd3e7 100644 --- a/python/cudf/cudf/core/dataframe.py +++ b/python/cudf/cudf/core/dataframe.py @@ -6020,7 +6020,7 @@ def nunique(self, axis=0, dropna=True): if axis != 0: raise NotImplementedError("axis parameter is not supported yet.") - return cudf.Series(super().nunique(method="sort", dropna=dropna)) + return cudf.Series(super().nunique(dropna=dropna)) def _sample_axis_1( self, diff --git a/python/cudf/cudf/core/frame.py b/python/cudf/cudf/core/frame.py index ece47400cce..07cc3ea71cd 100644 --- a/python/cudf/cudf/core/frame.py +++ b/python/cudf/cudf/core/frame.py @@ -6327,15 +6327,13 @@ def ge(self, other, axis="columns", level=None, fill_value=None): other=other, op="__ge__", fill_value=fill_value, can_reindex=True ) - def nunique(self, method: str = "sort", dropna: bool = True): + def nunique(self, dropna: bool = True): """ Returns a per column mapping with counts of unique values for each column. Parameters ---------- - method : str, default "sort" - Method used by cpp_distinct_count dropna : bool, default True Don't include NaN in the counts. @@ -6345,7 +6343,7 @@ def nunique(self, method: str = "sort", dropna: bool = True): Name and unique value counts of each column in frame. """ return { - name: col.distinct_count(method=method, dropna=dropna) + name: col.distinct_count(dropna=dropna) for name, col in self._data.items() } diff --git a/python/cudf/cudf/core/single_column_frame.py b/python/cudf/cudf/core/single_column_frame.py index 43e1c2cb46a..b35d653e28f 100644 --- a/python/cudf/cudf/core/single_column_frame.py +++ b/python/cudf/cudf/core/single_column_frame.py @@ -360,14 +360,12 @@ def _make_operands_for_binop( return {result_name: (self._column, other, reflect, fill_value)} @_cudf_nvtx_annotate - def nunique(self, method: str = "sort", dropna: bool = True): + def nunique(self, dropna: bool = True): """ Return count of unique values for the column. Parameters ---------- - method : str, default "sort" - Method used by cpp_distinct_count dropna : bool, default True Don't include NaN in the counts. @@ -378,4 +376,4 @@ def nunique(self, method: str = "sort", dropna: bool = True): """ if self._column.null_count == len(self): return 0 - return self._column.distinct_count(method=method, dropna=dropna) + return self._column.distinct_count(dropna=dropna)