diff options
| author | Pinapelz <yukais@pinapelz.com> | 2024-04-13 02:09:22 -0700 |
|---|---|---|
| committer | Pinapelz <yukais@pinapelz.com> | 2024-04-13 02:10:27 -0700 |
| commit | b5e2168b367f0b1a725c2920c355efe7f3e776c0 (patch) | |
| tree | 48b5f320cba479b2d49b4a2d40e71ceba542c66f | |
| parent | c0453a6ab7bb2e441d9811c715dc2615b69b2ada (diff) | |
fix: date conversion bug resulting in NaN predictions
| -rw-r--r-- | app.py | 5 |
1 files changed, 3 insertions, 2 deletions
@@ -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) |
