From cc480a6d59396fab51278600f55586fae2289be9 Mon Sep 17 00:00:00 2001 From: Simon Orlob <60964035+sorlob@users.noreply.github.com> Date: Thu, 28 Aug 2025 22:57:44 +0200 Subject: [PATCH] Update na_values handling for loading data refactor to deal with new style of non available values in most recent eolife export #251 --- src/vitabel/utils/loading.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/vitabel/utils/loading.py b/src/vitabel/utils/loading.py index 53fd227..551e632 100644 --- a/src/vitabel/utils/loading.py +++ b/src/vitabel/utils/loading.py @@ -2914,7 +2914,7 @@ def read_eolife_export(eolife_filepath: Path) -> EOLifeRecord: header=0, nrows=1, encoding="latin1", - na_values="NA", + na_values=["Na", "NA"], usecols=[ "Date", "Time", @@ -2961,7 +2961,7 @@ def read_eolife_export(eolife_filepath: Path) -> EOLifeRecord: skiprows=3, header=0, encoding="latin1", - na_values="Na", + na_values=["Na", "NA"], usecols=[ "Cycle number", "Time (hh:mm:ss:SS)", @@ -2986,7 +2986,7 @@ def read_eolife_export(eolife_filepath: Path) -> EOLifeRecord: "Leakage (mL)": "Int64", }, converters={ - "Leakage ratio (%)": lambda x: float(x) / 100 if x != "NA" else None + "Leakage ratio (%)": lambda x: float(x) / 100 if x not in ["Na", "NA"] else None }, )