From 63ee765a05c7f2449c10f9494177714a7fc89e42 Mon Sep 17 00:00:00 2001 From: joaquinbogado Date: Tue, 1 Aug 2023 14:19:14 +0200 Subject: [PATCH] Removed hardcoded date, sum only numeric columns --- lib/aip/models/prioritize.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/aip/models/prioritize.py b/lib/aip/models/prioritize.py index b85b6e0..e666a22 100644 --- a/lib/aip/models/prioritize.py +++ b/lib/aip/models/prioritize.py @@ -59,7 +59,7 @@ def _add_knowledge(last_knowledge, day): last_knowledge = pd.concat([last_knowledge, df]) dates_min = last_knowledge.groupby('orig').first_seen.min() dates_max = last_knowledge.groupby('orig').last_seen.max() - knowledge = last_knowledge.groupby('orig').sum() + knowledge = last_knowledge.groupby('orig').sum(numeric_only=True) knowledge.loc[:,'first_seen'] = dates_min knowledge.loc[:,'last_seen'] = dates_max knowledge.loc[:,'mean_flows'] = knowledge['flows']/knowledge['days_active'] @@ -116,7 +116,7 @@ def __init__(self, load_until='yesterday'): self._load_knowledge_until(day) - def build(self, start=date(2020, 7, 4), end=date.today() - timedelta(days=1), force=False): + def build(self, start=date.today() - timedelta(days=2), end=date.today() - timedelta(days=1), force=False): if path.exists(self.path) and not force: print('Knowledge exists already. Use force=True to rebuild it') return