From 613dda285089dac25c66952b4916835059e9c30f Mon Sep 17 00:00:00 2001 From: Felix Henneke Date: Tue, 3 Dec 2024 19:21:36 +0100 Subject: [PATCH] [Hotfix] Handle missing data (#440) This PR changes how missing data for reward targets is identified. It fixes a bug where missing data causes the script to crash. The issue seems to come from a column without valid values being misidentified as float column and the missing value is encoded as `NaN`. This was not identified as missing data since it only checks for `None`. With this PR, the pandas function `isna` is used to identify missing data. A similar approach was used in #435. Since local tests are still running, I created this as draft PR. I will remove the draft status once the local run is successful. --------- Co-authored-by: Haris Angelidakis <64154020+harisang@users.noreply.github.com> --- src/fetch/payouts.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/fetch/payouts.py b/src/fetch/payouts.py index 67816cb0..715ae0f1 100644 --- a/src/fetch/payouts.py +++ b/src/fetch/payouts.py @@ -107,12 +107,12 @@ def from_series(cls, frame: Series) -> RewardAndPenaltyDatum: ) solver = frame["solver"] reward_target = frame["reward_target"] - if reward_target is None: + if pandas.isna(reward_target): log.warning(f"Solver {solver} without reward_target. Using solver") reward_target = solver buffer_accounting_target = frame["buffer_accounting_target"] - if buffer_accounting_target is None: + if pandas.isna(buffer_accounting_target): log.warning( f"Solver {solver} without buffer_accounting_target. Using solver" )