Enable boolean type columns from pandas DataFrame to be suitably converted into numpy structured array
This commit is contained in:
@ -161,6 +161,8 @@ def convert_dataframe_to_np_structured_array(df: pd.DataFrame):
|
|||||||
dtype.append((col, 'i4')) # Assuming 32-bit integer
|
dtype.append((col, 'i4')) # Assuming 32-bit integer
|
||||||
elif pd.api.types.is_float_dtype(col_dtype):
|
elif pd.api.types.is_float_dtype(col_dtype):
|
||||||
dtype.append((col, 'f4')) # Assuming 32-bit float
|
dtype.append((col, 'f4')) # Assuming 32-bit float
|
||||||
|
elif pd.api.types.is_bool_dtype(col_dtype):
|
||||||
|
dtype.append((col,bool))
|
||||||
else:
|
else:
|
||||||
# Handle unsupported data types
|
# Handle unsupported data types
|
||||||
print(f"Unsupported dtype found in column '{col}': {col_data.dtype}")
|
print(f"Unsupported dtype found in column '{col}': {col_data.dtype}")
|
||||||
|
Reference in New Issue
Block a user