If present_on_multiple_rows_within is used and the data contains only one group of values in the variable specified in within (and possibly if there are multiple groups all with the same number of records), validation fails with the following error:
'DataFrame' object has no attribute 'tolist'
This error occurs because the data structure produced by groupby() is upcast to a DataFrame if all groups are the same length. Conditionally using stack() may prevent this error:
results = grouped.apply(lambda x: self.validate_series_length(x, target, min_count))
if not isinstance(results,pd.Series):
results = results.stack()
If
present_on_multiple_rows_within
is used and the data contains only one group of values in the variable specified inwithin
(and possibly if there are multiple groups all with the same number of records), validation fails with the following error:This error occurs because the data structure produced by
groupby()
is upcast to a DataFrame if all groups are the same length. Conditionally usingstack()
may prevent this error: