diff --git a/recommenders/models/sasrec/util.py b/recommenders/models/sasrec/util.py index 8c81b563c..b92999bd2 100644 --- a/recommenders/models/sasrec/util.py +++ b/recommenders/models/sasrec/util.py @@ -35,11 +35,13 @@ def __init__(self, **kwargs): if self.filename: with open(self.filename, "r") as fr: sample = fr.readline() - ncols = sample.strip().split(self.col_sep) + ncols = len(sample.strip().split(self.col_sep)) if ncols == 3: self.with_time = True - else: + elif ncols == 2: self.with_time = False + else: + raise ValueError(f"3 or 2 columns must be in dataset. Given {ncols} columns") def split(self, **kwargs): self.filename = kwargs.get("filename", self.filename)