Skip to content

Commit

Permalink
vectorize x_years_ago_at_date
Browse files Browse the repository at this point in the history
Signed-off-by: Victor Garcia Reolid <[email protected]>
  • Loading branch information
victorgarcia98 committed Mar 21, 2024
1 parent 6aa339b commit ddfd6a5
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions timely_beliefs/sensors/func_store/knowledge_horizons.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,11 +69,8 @@ def x_years_ago_at_date(
if isinstance(event_start, datetime):
return x_years_ago_at_date_datetime(event_start, day, month, x, z)
else:
return event_start.map(
lambda _event_start: x_years_ago_at_date_datetime(
_event_start, day, month, x, z
)
)
ref = event_start.to_period("1Y").to_timestamp().tz_localize(event_start.tz) + pd.DateOffset(month=month, day=day)
return event_start - ref


def ex_post(
Expand Down

0 comments on commit ddfd6a5

Please sign in to comment.