Skip to content

Commit

Permalink
Include a fix from #217 by @SamRWest
Browse files Browse the repository at this point in the history
  • Loading branch information
olejandro committed Jan 16, 2025
1 parent 910eeae commit 54bbf1d
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions xl2times/datatypes.py
Original file line number Diff line number Diff line change
Expand Up @@ -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}

Expand Down

0 comments on commit 54bbf1d

Please sign in to comment.