From 2774259e499ad025fe95ed9ddb72c0f1cd8e222e Mon Sep 17 00:00:00 2001 From: AmirAl-Jumaily Date: Tue, 7 May 2019 19:28:37 +0100 Subject: [PATCH] Print the correct column difference when dataframe columns do not match schema columns --- pandas_schema/schema.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/pandas_schema/schema.py b/pandas_schema/schema.py index 5c0442e..50355c8 100644 --- a/pandas_schema/schema.py +++ b/pandas_schema/schema.py @@ -60,7 +60,9 @@ def validate(self, df: pd.DataFrame, columns: typing.List[str] = None) -> typing columns_to_pair = [column for column in self.columns if column.name in columns] else: raise PanSchArgumentError( - 'Columns {} passed in are not part of the schema'.format(set(columns).difference(self.columns)) + 'Columns {} passed in are not part of the schema'.format(set(columns).difference( + self.get_column_names() + )) ) # We associate the column objects in the schema with data frame series either by name or by position, depending