From 527e0fa78492a64ccb89791e31e1c7e9b8b073f8 Mon Sep 17 00:00:00 2001 From: Steffen Slavetinsky Date: Wed, 31 Jan 2024 14:03:24 +0100 Subject: [PATCH] :bug: Fix pandas data source error if no nan values in column --- renumics/spotlight_plugins/core/pandas_data_source.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/renumics/spotlight_plugins/core/pandas_data_source.py b/renumics/spotlight_plugins/core/pandas_data_source.py index 4404a14d..7d026a62 100644 --- a/renumics/spotlight_plugins/core/pandas_data_source.py +++ b/renumics/spotlight_plugins/core/pandas_data_source.py @@ -142,17 +142,20 @@ def get_column_values( if pd.api.types.is_bool_dtype(column): values = column.to_numpy() na_mask = column.isna() - values[na_mask] = None + if na_mask.any(): + values[na_mask] = None return values if pd.api.types.is_integer_dtype(column): values = column.to_numpy() na_mask = column.isna() - values[na_mask] = None + if na_mask.any(): + values[na_mask] = None return values if pd.api.types.is_float_dtype(column): values = column.to_numpy() na_mask = column.isna() - values[na_mask] = None + if na_mask.any(): + values[na_mask] = None return values if pd.api.types.is_datetime64_any_dtype(column): return column.dt.tz_localize(None).to_numpy()