Skip to content

Commit

Permalink
lint (#1278, #1370)
Browse files Browse the repository at this point in the history
Signed-off-by: Derin Walters <[email protected]>
  • Loading branch information
derinwalters committed Oct 6, 2023
1 parent db4870b commit 5ce384d
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions pandera/backends/pandas/array.py
Original file line number Diff line number Diff line change
Expand Up @@ -326,9 +326,13 @@ def run_checks(self, check_obj, schema) -> List[CoreCheckResult]:
def set_default(self, check_obj, schema):
"""Sets the ``schema.default`` value on the ``check_obj``"""
# Ignore sparse dtype as it can't assign default value directly
if is_field(check_obj) and not isinstance(check_obj.dtype, pd.SparseDtype):
if is_field(check_obj) and not isinstance(
check_obj.dtype, pd.SparseDtype
):
check_obj.fillna(schema.default, inplace=True)
elif not is_field(check_obj) and not isinstance(check_obj[schema.name].dtype, pd.SparseDtype):
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)

return check_obj
Expand Down

0 comments on commit 5ce384d

Please sign in to comment.