From c7b108bdfa2de79e1f6ba0e8e25df79c21751a18 Mon Sep 17 00:00:00 2001 From: Daniel <d.hornung@indiscale.com> Date: Tue, 5 Sep 2023 10:48:21 +0200 Subject: [PATCH] MAINT: Put all dtype checks into one condition. --- src/caosadvancedtools/table_importer.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/caosadvancedtools/table_importer.py b/src/caosadvancedtools/table_importer.py index 065e1812..71ecd3ca 100755 --- a/src/caosadvancedtools/table_importer.py +++ b/src/caosadvancedtools/table_importer.py @@ -338,11 +338,11 @@ class TableImporter(): # float, because CaosDB does not have different sizes anyway. col_dtype = df.dtypes[key] if not strict and not np.issubdtype(col_dtype, datatype): - issub = np.issubdtype # These special cases should be fine. - if issub(col_dtype, np.integer) and issub(datatype, np.floating): - df[key] = df[key].astype(datatype) - elif datatype == str: + if ((datatype == str) + or (np.issubdtype(col_dtype, np.integer) + and np.issubdtype(datatype, np.floating)) + ): df[key] = df[key].astype(datatype) # Now check each element -- GitLab