mirror of
https://gh-proxy.org/https://github.com/klinsmaya/SQLBot.git
synced 2026-11-08 01:06:59 +08:00
fix: The system reports an error when uploading an Excel file with null values
This commit is contained in:
@@ -35,7 +35,8 @@ def parse_excel_preview(save_path: str, max_rows: int = 10):
|
||||
"fieldName": col,
|
||||
"fieldType": infer_field_type(df[col].dtype)
|
||||
})
|
||||
preview_data = df.head(max_rows).to_dict(orient='records')
|
||||
preview_df = df.head(max_rows).replace({pd.NA: None, float('nan'): None})
|
||||
preview_data = preview_df.to_dict(orient='records')
|
||||
sheets_data.append({
|
||||
"sheetName": "Sheet1",
|
||||
"fields": fields,
|
||||
@@ -52,7 +53,8 @@ def parse_excel_preview(save_path: str, max_rows: int = 10):
|
||||
"fieldName": col,
|
||||
"fieldType": infer_field_type(df[col].dtype)
|
||||
})
|
||||
preview_data = df.head(max_rows).to_dict(orient='records')
|
||||
preview_df = df.head(max_rows).replace({pd.NA: None, float('nan'): None})
|
||||
preview_data = preview_df.to_dict(orient='records')
|
||||
sheets_data.append({
|
||||
"sheetName": sheet_name,
|
||||
"fields": fields,
|
||||
|
||||
Reference in New Issue
Block a user