fix: 转换导入数据列名为字符串以避免UI层问题#228
Closed
seer-by-sentry[bot] wants to merge 1 commit into
Closed
Conversation
Contributor
There was a problem hiding this comment.
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes SECRANDOM-AS. The issue was that: DataFrame column names are integers, but code attempts access using string representations from UI, causing KeyError.
This fix was generated by Seer in Sentry, triggered by wsxyt. 👁️ Run ID: 1259156
Not quite right? Click here to continue debugging with Seer.