Fixed bug regarding datetime to str column conversion in dataframe by using .map(srt) (element wise operation) as opposed to .apply(str)

This commit is contained in:
2024-06-18 09:21:46 +02:00
parent b66dc11a62
commit a6868d985d

View File

@ -495,7 +495,9 @@ def save_processed_dataframe_to_hdf5(df, annotator, src_hdf5_path, script_date,
"""
# Convert datetime columns to string
datetime_cols = df.select_dtypes(include=['datetime64']).columns
df[datetime_cols] = df[datetime_cols].apply(str)
if list(datetime_cols):
df[datetime_cols] = df[datetime_cols].map(str)
# Convert dataframe to structured array
icad_data_table = utils.dataframe_to_np_structured_array(df)