Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove unused/single use methods #14739

Merged
merged 6 commits into from
Jan 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 0 additions & 6 deletions python/cudf/cudf/core/column/categorical.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
16 changes: 5 additions & 11 deletions python/cudf/cudf/core/column/column.py
Original file line number Diff line number Diff line change
Expand Up @@ -1271,12 +1271,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,
Expand All @@ -1303,13 +1297,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
Expand Down
9 changes: 5 additions & 4 deletions python/cudf/cudf/core/resample.py
Original file line number Diff line number Diff line change
@@ -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
#
Expand Down Expand Up @@ -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,
)
Expand Down
12 changes: 0 additions & 12 deletions python/cudf/cudf/utils/dtypes.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
# Copyright (c) 2020-2024, NVIDIA CORPORATION.

import datetime
from collections import namedtuple
from decimal import Decimal

import cupy as cp
Expand Down Expand Up @@ -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])
Expand Down
Loading