From 17e66cc8d915e2bce470d89ceb8aad9419d9b3ed Mon Sep 17 00:00:00 2001 From: James Higgie Date: Thu, 7 Dec 2023 09:43:06 +1100 Subject: [PATCH 1/2] improve data type handeling --- seeq/addons/mps/_mps_sdl_ui.py | 14 +++++++++----- seeq/addons/mps/_version.py | 2 +- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/seeq/addons/mps/_mps_sdl_ui.py b/seeq/addons/mps/_mps_sdl_ui.py index 4049127..f91cb76 100644 --- a/seeq/addons/mps/_mps_sdl_ui.py +++ b/seeq/addons/mps/_mps_sdl_ui.py @@ -638,11 +638,15 @@ def get_worksheet_data(self, workbook_id, worksheet_id): count += 1 for c in data_pull.columns: - if 'float64' != data_pull.dtypes[c]: - try: - signal_list.remove(c) - except: - pass + # Check if the column is not already float64 + if data_pull.dtypes[c] != 'float64': + # Use to_numeric for conversion, set errors='coerce' to handle exceptions + data_pull[c] = pd.to_numeric(data_pull[c], errors='coerce') + + # If after conversion column is still not float64, remove from signal_list if it exists + if data_pull.dtypes[c] != 'float64': + if c in signal_list: + signal_list.remove(c) except: pass diff --git a/seeq/addons/mps/_version.py b/seeq/addons/mps/_version.py index f0891e5..efc7796 100644 --- a/seeq/addons/mps/_version.py +++ b/seeq/addons/mps/_version.py @@ -1 +1 @@ -__version__ = '0.3.8' \ No newline at end of file +__version__ = '0.3.9' \ No newline at end of file From 9dc0965d543d05cf13e27c56e1d8892e86e60efe Mon Sep 17 00:00:00 2001 From: James Higgie Date: Thu, 7 Dec 2023 09:51:12 +1100 Subject: [PATCH 2/2] tweak --- seeq/addons/mps/_mps_sdl_ui.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/seeq/addons/mps/_mps_sdl_ui.py b/seeq/addons/mps/_mps_sdl_ui.py index f91cb76..17a9d21 100644 --- a/seeq/addons/mps/_mps_sdl_ui.py +++ b/seeq/addons/mps/_mps_sdl_ui.py @@ -638,14 +638,16 @@ def get_worksheet_data(self, workbook_id, worksheet_id): count += 1 for c in data_pull.columns: - # Check if the column is not already float64 + # Check if the column is not already float64 if data_pull.dtypes[c] != 'float64': # Use to_numeric for conversion, set errors='coerce' to handle exceptions data_pull[c] = pd.to_numeric(data_pull[c], errors='coerce') # If after conversion column is still not float64, remove from signal_list if it exists if data_pull.dtypes[c] != 'float64': - if c in signal_list: + try: + data_pull[c] = data_pull[c].astype('float64') + except: signal_list.remove(c) except: pass