summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPinapelz <yukais@pinapelz.com>2024-04-13 02:09:22 -0700
committerPinapelz <yukais@pinapelz.com>2024-04-13 02:10:27 -0700
commitb5e2168b367f0b1a725c2920c355efe7f3e776c0 (patch)
tree48b5f320cba479b2d49b4a2d40e71ceba542c66f
parentc0453a6ab7bb2e441d9811c715dc2615b69b2ada (diff)
fix: date conversion bug resulting in NaN predictions
-rw-r--r--app.py5
1 files 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)
send patches to the email below
yukais@pinapelz.com
include the subject [PATCH repo_name]
pinapelz.com
homepage