diff --git a/python/cudf/cudf/core/column/categorical.py b/python/cudf/cudf/core/column/categorical.py index 6b3ee0ba852..0ddb31efbfe 100644 --- a/python/cudf/cudf/core/column/categorical.py +++ b/python/cudf/cudf/core/column/categorical.py @@ -823,12 +823,6 @@ def ordered(self) -> bool: def ordered(self, value: bool): self.dtype.ordered = value - def unary_operator(self, unaryop: str): - raise TypeError( - f"Series of dtype `category` cannot perform the operation: " - f"{unaryop}" - ) - def __setitem__(self, key, value): if cudf.api.types.is_scalar( value diff --git a/python/cudf/cudf/core/column/column.py b/python/cudf/cudf/core/column/column.py index df5d1c3879a..7a99ef9f470 100644 --- a/python/cudf/cudf/core/column/column.py +++ b/python/cudf/cudf/core/column/column.py @@ -1241,12 +1241,6 @@ def normalize_binop_value( ) -> Union[ColumnBase, ScalarLike]: raise NotImplementedError - def _minmax(self, skipna: Optional[bool] = None): - result_col = self._process_for_reduction(skipna=skipna) - if isinstance(result_col, ColumnBase): - return libcudf.reduce.minmax(result_col) - return result_col - def _reduce( self, op: str, @@ -1273,13 +1267,13 @@ def _reduce( def _process_for_reduction( self, skipna: Optional[bool] = None, min_count: int = 0 ) -> Union[ColumnBase, ScalarLike]: - skipna = True if skipna is None else skipna + if skipna is None: + skipna = True - if skipna: - if self.has_nulls(): + if self.has_nulls(): + if skipna: result_col = self.dropna() - else: - if self.has_nulls(): + else: return cudf.utils.dtypes._get_nan_for_dtype(self.dtype) result_col = self diff --git a/python/cudf/cudf/core/resample.py b/python/cudf/cudf/core/resample.py index fbf25104303..0226c778da3 100644 --- a/python/cudf/cudf/core/resample.py +++ b/python/cudf/cudf/core/resample.py @@ -1,4 +1,4 @@ -# SPDX-FileCopyrightText: Copyright (c) 2021-2023, NVIDIA CORPORATION & +# SPDX-FileCopyrightText: Copyright (c) 2021-2024, NVIDIA CORPORATION & # AFFILIATES. All rights reserved. SPDX-License-Identifier: # Apache-2.0 # @@ -217,10 +217,11 @@ def _handle_frequency_grouper(self, by): # get the start and end values that will be used to generate # the bin labels - min_date, max_date = key_column._minmax() + min_date = key_column._reduce("min") + max_date = key_column._reduce("max") start, end = _get_timestamp_range_edges( - pd.Timestamp(min_date.value), - pd.Timestamp(max_date.value), + pd.Timestamp(min_date), + pd.Timestamp(max_date), offset, closed=closed, ) diff --git a/python/cudf/cudf/utils/dtypes.py b/python/cudf/cudf/utils/dtypes.py index 72721b5197f..df363b72909 100644 --- a/python/cudf/cudf/utils/dtypes.py +++ b/python/cudf/cudf/utils/dtypes.py @@ -1,7 +1,6 @@ # Copyright (c) 2020-2024, NVIDIA CORPORATION. import datetime -from collections import namedtuple from decimal import Decimal import cupy as cp @@ -139,17 +138,6 @@ def np_to_pa_dtype(dtype): return _np_pa_dtypes[cudf.dtype(dtype).type] -def get_numeric_type_info(dtype): - _TypeMinMax = namedtuple("_TypeMinMax", "min,max") - if dtype.kind in {"i", "u"}: - info = np.iinfo(dtype) - return _TypeMinMax(info.min, info.max) - elif dtype.kind == "f": - return _TypeMinMax(dtype.type("-inf"), dtype.type("+inf")) - else: - raise TypeError(dtype) - - def numeric_normalize_types(*args): """Cast all args to a common type using numpy promotion logic""" dtype = np.result_type(*[a.dtype for a in args])