Skip to content

Commit 070e6e2

Browse files
committed
address reviews
1 parent cdff0a0 commit 070e6e2

3 files changed

Lines changed: 3 additions & 23 deletions

File tree

python/cudf/cudf/core/column/column.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1012,8 +1012,6 @@ def _dispatch_subclass_from_dtype(dtype: DtypeObj) -> type[ColumnBase]:
10121012
if is_dtype_obj_numeric(dtype, include_decimal=False):
10131013
return cudf.core.column.NumericalColumn
10141014

1015-
if dtype_kind == "U":
1016-
return cudf.core.column.StringColumn
10171015
raise TypeError(f"Unrecognized dtype: {dtype}")
10181016

10191017
@staticmethod

python/cudf/cudf/core/column/numerical.py

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -646,13 +646,7 @@ def as_string_column(self, dtype: DtypeObj) -> StringColumn:
646646
cudf.core.column.string.StringColumn,
647647
ColumnBase.create(conv_func(col.plc_column), dtype),
648648
)
649-
if self.dtype == np.dtype(np.float32):
650-
# Collapse float32 artifacts like 0.100000001 -> 0.1.
651-
# https://github.com/pandas-dev/pandas/pull/36464
652-
result = result.replace_with_backrefs(
653-
r"^([+-]?[0-9]+(?:\.[0-9]*?[1-9])?)0{6,}[0-9]+$",
654-
r"\1",
655-
)
649+
656650
return result
657651

658652
def _as_temporal_column(self, dtype: np.dtype) -> plc.Column:

python/cudf/cudf/core/series.py

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -90,18 +90,6 @@ def _format_percentile_names(percentiles: np.ndarray) -> list[str]:
9090
return [f"{int(x * 100)}%" for x in percentiles]
9191

9292

93-
def _is_simple_str_lambda(func: Any) -> bool:
94-
code = getattr(func, "__code__", None)
95-
return (
96-
callable(func)
97-
and getattr(func, "__name__", None) == "<lambda>"
98-
and code is not None
99-
and code.co_argcount == 1
100-
and code.co_names == ("str",)
101-
and code.co_consts == (None,)
102-
)
103-
104-
10593
def _describe_numeric(obj: Series, percentiles: np.ndarray) -> dict[str, Any]:
10694
# Helper for Series.describe with numerical data.
10795
return {
@@ -1273,7 +1261,7 @@ def map(self, arg, na_action: None | Literal["ignore"] = None) -> Self:
12731261
result = res["s"]
12741262
result.name = self.name
12751263
result.index = self.index
1276-
elif arg is str or _is_simple_str_lambda(arg):
1264+
elif arg is str:
12771265
if self.dtype.kind == "M":
12781266
from cudf.core.column.datetime import (
12791267
_dtype_to_format_conversion,
@@ -2650,7 +2638,7 @@ def apply(
26502638
raise ValueError("Series.apply only supports convert_dtype=True")
26512639
elif by_row != "compat":
26522640
raise NotImplementedError("by_row is currently not supported.")
2653-
elif func is str or _is_simple_str_lambda(func):
2641+
elif func is str:
26542642
result = self.map(func)
26552643
result.name = self.name
26562644
return result

0 commit comments

Comments
 (0)