convert number cols as string if this is in schema

This commit is contained in:
Cayo Puigdefabregas 2024-02-27 15:28:25 +01:00
parent fd6035aba0
commit 3efd530d18

View file

@ -227,6 +227,8 @@ class ImportForm(forms.Form):
df[col] = df[col].dt.strftime("%Y-%m-%d")
for col in df.select_dtypes(include=['number']).columns:
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()