Skip to content

fix: round integer values during Excel and CSV import - #1381

Merged
xuwei-fit2cloud merged 1 commit into
mainfrom
codex/fix-1365-integer-import
Sep 17, 2026
Merged

xuwei-fit2cloud merged 1 commit into
mainfrom
codex/fix-1365-integer-import

Conversation

@xuwei-fit2cloud

Copy link
Copy Markdown
Collaborator

Fixes #1365.

When an Excel or CSV column is explicitly imported as an integer, decimal values were truncated (for example, 1186.6071672 became 1186). Round these values using ROUND_HALF_UP so the example imports as 1187, preserve missing values with nullable integers, and reject invalid, non-finite, or out-of-range values. Other selected column types retain their existing behavior.

Validation: 31 local regression tests passed, covering Excel formula cached values, CSV input, rounding, nulls, precision, and signed 64-bit boundaries. The regression tests and workbook fixture remain local and are not included in this PR, as requested. Only the two datasource implementation files are included.

Copilot AI lite review requested due to automatic review settings September 17, 2026 07:46
@xuwei-fit2cloud
xuwei-fit2cloud merged commit 93e5307 into main Sep 17, 2026
4 checks passed
@xuwei-fit2cloud
xuwei-fit2cloud deleted the codex/fix-1365-integer-import branch September 17, 2026 07:46

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Non-finite CSV values may be silently imported as NULL instead of being rejected.

Get a fresh assessment by requesting another Copilot review.

Pull request overview

Updates Excel/CSV imports to round explicitly selected integer values using ROUND_HALF_UP, preserve nulls, and validate inputs.

Changes:

  • Added validated integer rounding and range checks.
  • Centralized Excel/CSV import loading.
  • Updated datasource integration.
File summaries
File Description
backend/apps/datasource/utils/excel.py Implements validated integer rounding during imports.
backend/apps/datasource/api/datasource.py Uses the shared import dataframe loader.
Review details
  • Files reviewed: 2/2 changed files
  • Comments generated: 1
  • Review effort level: Lite

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment on lines +32 to +33
if pd.isna(value) or (isinstance(value, str) and not value.strip()):
return pd.NA
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG]导入的数据小数位科学技术法有点问题

2 participants