You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Adding an expectation that a column in Pandas be of type list or array raises an error:
import great_expectations as ge
import pandas as pd
df = pd.DataFrame(
{'a':[1,2,3,4,5],
'b':[[1,2], [3,4], [5], [6,7,8], [9, 10, 11]]}
)
geset = ge.dataset.PandasDataset(df)
#these two work
geset.expect_column_values_to_be_of_type('a', 'int')
geset.expect_column_values_to_be_of_type('a', 'int64')
#these don't work :(
geset.expect_column_values_to_be_of_type('b', 'array')
geset.expect_column_values_to_be_of_type('b', 'list')
Traceback here:
---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
<ipython-input-11-17211834476d> in <module>()
11
12 #these don't work :(
---> 13 geset.expect_column_values_to_be_of_type('b', 'array')
14 geset.expect_column_values_to_be_of_type('b', 'list')
/Users/Shared/anaconda3/lib/python3.6/site-packages/great_expectations/data_asset/util.py in f(*args, **kwargs)
83 @wraps(self.mthd, assigned=('__name__', '__module__'))
84 def f(*args, **kwargs):
---> 85 return self.mthd(obj, *args, **kwargs)
86
87 f.__doc__ = doc
/Users/Shared/anaconda3/lib/python3.6/site-packages/great_expectations/dataset/pandas_dataset.py in expect_column_values_to_be_of_type(self, column, type_, **kwargs)
507 else:
508 res = self._expect_column_values_to_be_of_type__map(
--> 509 column, type_, **kwargs
510 )
511 # Note: this logic is similar to the logic in _append_expectation for deciding when to overwrite an
/Users/Shared/anaconda3/lib/python3.6/site-packages/great_expectations/data_asset/data_asset.py in wrapper(self, *args, **kwargs)
234
235 else:
--> 236 raise err
237
238 else:
/Users/Shared/anaconda3/lib/python3.6/site-packages/great_expectations/data_asset/data_asset.py in wrapper(self, *args, **kwargs)
221 if self._config.get("interactive_evaluation", True) or self._active_validation:
222 try:
--> 223 return_obj = func(self, **evaluation_args)
224
225 except Exception as err:
/Users/Shared/anaconda3/lib/python3.6/site-packages/great_expectations/dataset/pandas_dataset.py in inner_wrapper(self, column, mostly, result_format, *args, **kwargs)
82 else:
83 boolean_mapped_null_values = np.array([True if (value in ignore_values) or (pd.isnull(value)) else False
---> 84 for value in series])
85
86 element_count = int(len(series))
/Users/Shared/anaconda3/lib/python3.6/site-packages/great_expectations/dataset/pandas_dataset.py in <listcomp>(.0)
82 else:
83 boolean_mapped_null_values = np.array([True if (value in ignore_values) or (pd.isnull(value)) else False
---> 84 for value in series])
85
86 element_count = int(len(series))
ValueError: The truth value of an array with more than one element is ambiguous. Use a.any() or a.all()
The text was updated successfully, but these errors were encountered:
Mentioned in Slack
Adding an expectation that a column in Pandas be of type list or array raises an error:
Traceback here:
The text was updated successfully, but these errors were encountered: