From 3efd530d1842ec9509d10255d6adcca3efde7455 Mon Sep 17 00:00:00 2001 From: Cayo Puigdefabregas Date: Tue, 27 Feb 2024 15:28:25 +0100 Subject: [PATCH] convert number cols as string if this is in schema --- idhub/admin/forms.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/idhub/admin/forms.py b/idhub/admin/forms.py index 2ee9d60..27f83fe 100644 --- a/idhub/admin/forms.py +++ b/idhub/admin/forms.py @@ -227,7 +227,9 @@ class ImportForm(forms.Form): df[col] = df[col].dt.strftime("%Y-%m-%d") for col in df.select_dtypes(include=['number']).columns: - df[col] = df[col].astype(str) + sc_col = self.json_schema.get("properties", {}).get(col, {}) + if sc_col.get("type") == "string": + df[col] = df[col].astype(str) data_pd = df.fillna('').to_dict()