Skip to content

Commit

Permalink
no_silent_downcasting doesn't exist in old pandas
Browse files Browse the repository at this point in the history
  • Loading branch information
jeromedockes committed Jul 5, 2024
1 parent f004900 commit e2d4437
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions skrub/_dataframe/_common.py
Original file line number Diff line number Diff line change
Expand Up @@ -706,8 +706,7 @@ def _to_string_pandas(col):
return col
if not is_na.any():
return col
with pd.option_context("future.no_silent_downcasting", True):
return col.fillna(np.nan)
return _fill_nulls_pandas(col, np.nan)


@to_string.specialize("polars", argument_type="Column")
Expand Down Expand Up @@ -1025,6 +1024,8 @@ def fill_nulls(obj, value):

@fill_nulls.specialize("pandas")
def _fill_nulls_pandas(obj, value):
if parse_version(pd.__version__) < parse_version("2.2.0"):
return obj.fillna(value)
with pd.option_context("future.no_silent_downcasting", True):
return obj.fillna(value)

Expand Down

0 comments on commit e2d4437

Please sign in to comment.