From 7a18928fc15119ecab1fa59dc0a3123c7ab753f9 Mon Sep 17 00:00:00 2001 From: Felipe Date: Wed, 18 Oct 2023 15:27:04 -0400 Subject: [PATCH] Fix datetime issue --- sdmetrics/single_table/new_row_synthesis.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/sdmetrics/single_table/new_row_synthesis.py b/sdmetrics/single_table/new_row_synthesis.py index 0895aad7..cc3fbb37 100644 --- a/sdmetrics/single_table/new_row_synthesis.py +++ b/sdmetrics/single_table/new_row_synthesis.py @@ -73,6 +73,10 @@ def compute_breakdown(cls, real_data, synthetic_data, metadata=None, for field, field_meta in get_columns_from_metadata(metadata).items(): if get_type_from_column_meta(field_meta) == 'datetime': + if len(real_data[field]) > 0 and isinstance(real_data[field][0], str): + real_data[field] = pd.to_datetime(real_data[field]) + synthetic_data[field] = pd.to_datetime(synthetic_data[field]) + real_data[field] = pd.to_numeric(real_data[field]) synthetic_data[field] = pd.to_numeric(synthetic_data[field])