Open gdementen opened 3 years ago
As a workaround in this case, we can change the axis type to string then use strings to reindex then rechange the labels but that's kinda awful:
>>> arr.set_labels("year", str).reindex("year", ["2020", "a", "2022", "b"]).set_labels("year", {"2020": 2020, "2022": 2022})
year 2020 a 2022 b
0.0 nan 2.0 nan
related to #910
With recent versions of larray (at least 0.34.6), this now silently returns a bad result, instead of the cryptic error message, which is much worse, so I just bumped priority.
>>> arr = ndtest("year=2020..2022")
>>> res = arr.reindex("year", [2020, "a", 2022, "b"])
>>> res
year 2020 a 2022 b
nan nan nan nan
>>> res.info
4
year [4]: '2020' 'a' '2022' 'b'
dtype: float64
memory used: 32 bytes
Bonus point for the totally cryptic error message 😉