From 48181662ddd0835e167d6c5cb54c005c82f8cd6a Mon Sep 17 00:00:00 2001 From: Olexandr Balyk Date: Thu, 16 Jan 2025 12:23:55 -0500 Subject: [PATCH] Include a fix from #217 by @SamRWest --- xl2times/datatypes.py | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/xl2times/datatypes.py b/xl2times/datatypes.py index 0ff044d1..6fa85ce0 100644 --- a/xl2times/datatypes.py +++ b/xl2times/datatypes.py @@ -262,8 +262,16 @@ def data_years(self) -> set[int]: for attributes in [self.attributes, self.uc_attributes]: if not attributes.empty: # Index of the year column with non-empty values - index = attributes["year"] != "" - data_years.update(attributes["year"][index].astype(int).values) + # index = attributes["year"] != "" + # data_years.update(attributes["year"][index].astype(int).values) + # TODO: Ensure that non-parseble vals don't get this far + int_years = attributes["year"].astype( + int, errors="ignore" + ) # leave non-parseable vals alone + int_years = [ + y for y in int_years if isinstance(y, int) + ] # remove non-parseable years + data_years.update(int_years) # Remove interpolation rules before return return {y for y in data_years if y >= 1000}