Skip to content

Commit

Permalink
Pandas 2.2.0 FutureWarning resolution by using assignment instead of …
Browse files Browse the repository at this point in the history
…inplace (#1464)

Signed-off-by: Derin Walters <[email protected]>
  • Loading branch information
derinwalters authored Feb 19, 2024
1 parent 971bf5f commit 3c8c28b
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions pandera/backends/pandas/array.py
Original file line number Diff line number Diff line change
Expand Up @@ -329,11 +329,13 @@ def set_default(self, check_obj, schema):
if is_field(check_obj) and not isinstance(
check_obj.dtype, pd.SparseDtype
):
check_obj.fillna(schema.default, inplace=True)
check_obj = check_obj.fillna(schema.default)
elif not is_field(check_obj) and not isinstance(
check_obj[schema.name].dtype, pd.SparseDtype
):
check_obj[schema.name].fillna(schema.default, inplace=True)
check_obj[schema.name] = check_obj[schema.name].fillna(
schema.default
)

return check_obj

Expand Down

0 comments on commit 3c8c28b

Please sign in to comment.