diff --git a/pandas_schema/column.py b/pandas_schema/column.py index 199b883..6c64858 100644 --- a/pandas_schema/column.py +++ b/pandas_schema/column.py @@ -24,4 +24,9 @@ def validate(self, series: pd.Series) -> typing.List[ValidationWarning]: :param series: A pandas Series to validate :return: An iterable of ValidationError instances generated by the validation """ - return [error for validation in self.validations for error in validation.get_errors(series, self)] + + # skip validation if column contains no validation objects. Used for columns that require no validation but must be present in DataFrame + if self.validations == []: + return [] + else: + return [error for validation in self.validations for error in validation.get_errors(series, self)]