From b5e2168b367f0b1a725c2920c355efe7f3e776c0 Mon Sep 17 00:00:00 2001 From: Pinapelz Date: Sat, 13 Apr 2024 02:09:22 -0700 Subject: fix: date conversion bug resulting in NaN predictions --- app.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/app.py b/app.py index 4026960..b437d8e 100644 --- a/app.py +++ b/app.py @@ -113,8 +113,9 @@ def get_channel_information(channel_name): next_milestone = find_next_milestone(current_subscriber_count) days_until_next_milestone = (next_milestone - model.intercept_) / model.coef_ days_until_next_milestone_scalar = int(days_until_next_milestone[0]) - next_milestone_date = (df.index[0] + pandas.Timedelta(days=days_until_next_milestone_scalar)).date() - time_until_next_milestone = (next_milestone_date - datetime.datetime.now().date()).days + today = datetime.datetime.now().date() + next_milestone_date = today + datetime.timedelta(days=days_until_next_milestone_scalar) + time_until_next_milestone = (next_milestone_date - today).days if time_until_next_milestone < 0: raise OverflowError channel_data["next_milestone_date"] = str(next_milestone_date) -- cgit v1.2.3