diff --git a/src/Dataset.py b/src/Dataset.py index 52024c9c8b716a9fc9da3575528e8aece99d2a7d..a192474c67ec4ef3e8c24630fa2021c007103dc7 100644 --- a/src/Dataset.py +++ b/src/Dataset.py @@ -270,6 +270,10 @@ class Dataset: if type(colname) != str: logging.error("parameter `colname` is not a string") raise ValueError(f"{colname} is not a string") + if colname not in self.dataframe.columns: + logging.error("column requested not in dataframe") + raise KeyError(f"{colname} is not a column in dataframe") + if not (ascending is None or type(ascending) is bool): logging.error("parameter `ascending` is not a bool or None") raise ValueError(f"{ascending} is not a bool or None")