From 69971c8a5aa11781d4b9e8ec821670400ced22cc Mon Sep 17 00:00:00 2001 From: James Crake-Merani Date: Fri, 20 Dec 2024 12:04:57 +0000 Subject: [PATCH] Dodgy implementation of `all_axis_match` --- sasdata/trend.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/sasdata/trend.py b/sasdata/trend.py index 46ac808..b9965be 100644 --- a/sasdata/trend.py +++ b/sasdata/trend.py @@ -16,8 +16,16 @@ class Trend: def __getitem__(self, item) -> SasData: raise NotImplementedError() + # TODO: Assumes there are at least 2 items in data. Is this reasonable to assume? Should there be error handling for + # situations where this may not be the case? def all_axis_match(self, axis: str) -> bool: - raise NotImplementedError() + reference_data = self.data[0] + for datum in self.data[1::]: + contents = datum._data_contents + axis_datum = [content for content in contents if content.name == axis][0] + if axis_datum != datum: + return False + return True # TODO: Not sure if this should return a new trend, or just mutate the existing trend # TODO: May be some details on the method as well.