find closest date returns nan for min/max failure as well
This commit is contained in:
parent
18b60bd608
commit
7b65f6ff3f
@ -188,9 +188,15 @@ def _find_closest_date(
|
||||
"""
|
||||
|
||||
if delta.days < 0 and date < min(data.data):
|
||||
raise DateOutOfRangeError(date, "min")
|
||||
if if_not_found == "nan":
|
||||
return float("NaN"), float("NaN")
|
||||
else:
|
||||
raise DateOutOfRangeError(date, "min")
|
||||
if delta.days > 0 and date > max(data.data):
|
||||
raise DateOutOfRangeError(date, "max")
|
||||
if if_not_found == "nan":
|
||||
return float("NaN"), float("NaN")
|
||||
else:
|
||||
raise DateOutOfRangeError(date, "max")
|
||||
|
||||
row: tuple = data.get(date, None)
|
||||
if row is not None:
|
||||
|
Loading…
Reference in New Issue
Block a user