Skip to content
Snippets Groups Projects

F fix strict values in table columns

Merged Florian Spreckelsen requested to merge f-fix-strict-values-in-table-columns into dev
4 unresolved threads
Files
3
@@ -322,7 +322,7 @@ class TableImporter():
.. note::
If columns are integer, but should be float, this method converts the respective columns
in place.
in place. The same for columns that should have string value but have numeric value.
Parameters
----------
@@ -338,9 +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):
if ((datatype == str)
or (np.issubdtype(col_dtype, np.integer)
and np.issubdtype(datatype, np.floating))
): # NOQA
df[key] = df[key].astype(datatype)
Please register or sign in to reply
# Now check each element
Loading