Skip to content

Fix multiple bugs across pandas, data_analysis, and SunHot modules - #4

Draft
ItsAyaya with Copilot wants to merge 2 commits into
mainfrom
copilot/improve-project-accuracy
Draft

Fix multiple bugs across pandas, data_analysis, and SunHot modules#4
ItsAyaya with Copilot wants to merge 2 commits into
mainfrom
copilot/improve-project-accuracy

Conversation

Copilot AI commented Mar 11, 2026

Copy link
Copy Markdown

Several correctness bugs across the notebook lessons and Scrapy project: broken sort logic, wrong variable printed, resource leaks, silent crash on network failure, and a disabled pipeline.

Bug Fixes

  • pandas/ch2.ipynb Cell 26 — silent no-op sort: Trailing comma after sort_values([...]) turned ascending and inplace into standalone tuple expressions; the sort never executed.

    # Before (broken — ascending/inplace are ignored)
    df.sort_values(['销售毛利','销售收入']),
    ascending=[False,True],
    inplace=(True)
    
    # After
    df.sort_values(['销售毛利','销售收入'],
                   ascending=[False,True],
                   inplace=True)
  • pandas/ch3.ipynb Cells 21 & 22 — KeyError on column access: Cell 20 renames columns with (万元) suffix via inplace=True; subsequent cells still referenced the original names. Updated to 销售收入(万元) etc.

  • data_analysis/Ch5.ipynb Cell 98 — wrong variable printed: print(books) dumped the entire source object instead of the filtered titles result.

  • data_analysis/Ch5.ipynb Cells 91, 92, 94, 100, 104 — file handle leaks: Bare open() calls never closed. Replaced with with context managers.

  • data_analysis/Ch4.ipynb — uncaught network errors: load_page() propagated URLError directly; added try/except returning None. write_page() now guards against None input instead of raising AttributeError.

  • SunHot/settings.py — pipeline never ran: ITEM_PIPELINES was commented out; scraped items were never processed. Enabled SunhotPipeline.

Original prompt

分析我的项目并进一步改进,修正我项目中的错误,进一步提升预测准确性与正确率

创建自 VS Code


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

…rs, error handling, pipeline

Co-authored-by: ItsAyaya <79414931+ItsAyaya@users.noreply.github.com>
Copilot AI changed the title [WIP] Analyze project and enhance prediction accuracy Fix multiple bugs across pandas, data_analysis, and SunHot modules Mar 11, 2026
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