Skip to content

fix: 转换导入数据列名为字符串以避免UI层问题#228

Closed
seer-by-sentry[bot] wants to merge 1 commit into
masterfrom
seer/fix/import-column-names-to-string
Closed

fix: 转换导入数据列名为字符串以避免UI层问题#228
seer-by-sentry[bot] wants to merge 1 commit into
masterfrom
seer/fix/import-column-names-to-string

Conversation

@seer-by-sentry
Copy link
Copy Markdown
Contributor

@seer-by-sentry seer-by-sentry Bot commented May 8, 2026

Fixes SECRANDOM-AS. The issue was that: DataFrame column names are integers, but code attempts access using string representations from UI, causing KeyError.

  • 将所有导入数据的列名转换为字符串类型。
  • 避免因整数列名与UI层期望字符串不匹配而导致的问题。

This fix was generated by Seer in Sentry, triggered by wsxyt. 👁️ Run ID: 1259156

Not quite right? Click here to continue debugging with Seer.

@WSXYT WSXYT marked this pull request as ready for review May 8, 2026 16:34
Copilot AI review requested due to automatic review settings May 8, 2026 16:34
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR addresses a UI/data mismatch where imported pandas DataFrame column names can be integers, but the UI layer provides/uses string column keys, leading to KeyError during row access.

Changes:

  • Convert all imported DataFrame column names to strings immediately after loading (Excel/CSV) to align with UI expectations.
  • Minor formatting/line-ending-only change near a logging statement.
Comments suppressed due to low confidence (1)

app/view/another_window/student/import_student_name.py:945

  • This line appears to have been modified only due to line-ending/whitespace differences (the content is otherwise identical). Please avoid introducing whitespace-only changes here (e.g., normalize the file’s EOLs consistently and revert this hunk if no functional change is intended) to reduce diff noise and prevent mixed line endings.
                f"已覆盖班级 '{class_name}' 的数据,共 {len(all_students)} 名学生"
            )
        else:
            logger.info(f"已保存 {len(all_students)} 名学生到新班级 '{class_name}'")



💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@WSXYT WSXYT closed this May 8, 2026
@WSXYT WSXYT deleted the seer/fix/import-column-names-to-string branch May 8, 2026 16:56
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.

2 participants