Skip to content

Commit

Permalink
Merge branch 'Giskard-AI:main' into gemini_client
Browse files Browse the repository at this point in the history
  • Loading branch information
abdellah257 committed May 18, 2024
2 parents 7b37317 + f1c1a8f commit 80ee393
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion giskard/push/perturbation.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
from typing import Optional

import hashlib
import numbers

import numpy as np
import pandas as pd
Expand All @@ -35,6 +36,14 @@

from ..push import PerturbationPush

try:
from pandas.api.types import is_any_real_numeric_dtype
except ImportError:

def is_any_real_numeric_dtype(array: np.array) -> bool:
return issubclass(array.dtype.type, numbers.Real)


text_transformation_list = [
TextLowercase,
TextUppercase,
Expand Down Expand Up @@ -121,7 +130,7 @@ def _apply_perturbation(
ds_slice_copy = ds_slice.copy()

# Apply the transformation
if col_type == SupportedPerturbationType.NUMERIC:
if col_type == SupportedPerturbationType.NUMERIC and is_any_real_numeric_dtype(ds_slice.df[feature]):
passed = _numeric(
ds,
ds_slice,
Expand Down

0 comments on commit 80ee393

Please sign in to comment.