Skip to content

Commit 3fcc667

Browse files
committed
2.4.2 Start - fix: FutureWarning: errors='ignore' is deprecated and will raise in a future version.
1 parent 744873b commit 3fcc667

File tree

2 files changed

+11
-4
lines changed

2 files changed

+11
-4
lines changed

clarite/modules/modify.py

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -538,9 +538,16 @@ def make_continuous(
538538
columns = _validate_skip_only(data, skip, only)
539539

540540
# Convert dtype, ignoring errors
541-
data.loc[:, columns] = data.loc[:, columns].apply(
542-
lambda col: pd.to_numeric(col, errors="ignore")
543-
)
541+
# data.loc[:, columns] = data.loc[:, columns].apply(
542+
# lambda col: pd.to_numeric(col, errors="ignore")
543+
# )
544+
def try_convert(col):
545+
try:
546+
return pd.to_numeric(col)
547+
except Exception:
548+
return col
549+
550+
data.loc[:, columns] = data.loc[:, columns].apply(try_convert)
544551

545552
# Check if any variables could not be converted
546553
failed_conversion = data.loc[:, columns].dtypes.apply(

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[tool.poetry]
22
name = "clarite"
3-
version = "2.4.1"
3+
version = "2.4.2"
44
description = "CLeaning to Analysis: Reproducibility-based Interface for Traits and Exposures"
55
authors = ["Andre Rico <[email protected]>"]
66
license = "BSD-3-Clause"

0 commit comments

Comments
 (0)