Skip to content

[pandas, pandas_panel] Update lectures for pandas 3.0 compatibility#470

Merged
mmcky merged 2 commits into
mainfrom
update-pandas-3.0
Jun 19, 2026
Merged

[pandas, pandas_panel] Update lectures for pandas 3.0 compatibility#470
mmcky merged 2 commits into
mainfrom
update-pandas-3.0

Conversation

@mmcky

@mmcky mmcky commented Feb 10, 2026

Copy link
Copy Markdown
Contributor

Summary

Updates pandas.md and pandas_panel.md for compatibility with pandas 3.0 (What's New).

Rebased on current main, which now ships pandas 3.0.3 via anaconda=2026.06 (#562). The earlier interim pandas>=3 pip pin and anaconda=2025.12 are therefore no longer needed, so this PR now carries only the lecture changes — no environment.yml change.

Changes

pandas_panel.md

  • Remove redundant future_stack=True from all .stack() calls — the new stacking layout is the default in pandas 3.0.
  • Update text: groupby axis=1 support is now described as "removed" (not "deprecated"); it is fully removed in 3.0. The lecture already uses the .T.groupby() pattern.

pandas.md

  • df.where(df.POP >= 20000, False)df.where(df.POP >= 20000) so the example fills non-matching rows with NaN (the standard .where() behaviour) instead of scattering False through the string columns. Text updated to match.

Validation

A full no-cache execution build under anaconda=2026.06 (pandas 3.0.3) was run via cache.yml; all 26 lectures execute. These lecture edits keep the pandas examples clean and free of the deprecated future_stack keyword.

@mmcky mmcky changed the title Update lectures for pandas 3.0 compatibility [pandas, pandas_panel] Update lectures for pandas 3.0 compatibility Feb 10, 2026
@github-actions

github-actions Bot commented Feb 10, 2026

Copy link
Copy Markdown

@github-actions github-actions Bot temporarily deployed to pull request February 10, 2026 03:54 Inactive
@mmcky mmcky added the blocked label Mar 22, 2026
anaconda 2026.06 (merged in #562) ships pandas 3.0.3, so the interim
pandas>=3 pip pin and anaconda=2025.12 are no longer needed. This branch
now carries only the lecture updates:

- pandas_panel: drop redundant future_stack=True from .stack() calls
  (the new stacking layout is the default in pandas 3.0)
- pandas_panel: text now says axis=1 in groupby is "removed" not
  "deprecated" (it is fully removed in 3.0)
- pandas: df.where(df.POP >= 20000, False) -> df.where(df.POP >= 20000)
  so the example fills non-matching rows with NaN instead of scattering
  False through the string columns

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@mmcky mmcky force-pushed the update-pandas-3.0 branch from cf97441 to 12c275c Compare June 19, 2026 02:14
Copilot AI review requested due to automatic review settings June 19, 2026 02:14

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Updates the pandas lecture content in this Jupyter Book (MyST Markdown) repository to align examples and narrative with pandas 3.0 behavior, keeping the rendered lectures executable under the current environment (pandas 3.0.3 via anaconda 2026.06).

Changes:

  • Adjust df.where(...) example in pandas.md to use default NaN fill behavior instead of inserting False across non-matching rows.
  • Remove now-unnecessary future_stack=True from .stack() calls in pandas_panel.md and update wording about groupby(axis=1) being removed.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
lectures/pandas.md Updates a .where() example and accompanying explanation to reflect default NaN behavior.
lectures/pandas_panel.md Removes future_stack=True usages and updates text to match pandas 3.0 removals.

Comment thread lectures/pandas.md Outdated
Comment thread lectures/pandas_panel.md Outdated
@github-actions github-actions Bot temporarily deployed to pull request June 19, 2026 02:21 Inactive
@mmcky mmcky removed the blocked label Jun 19, 2026
- pandas: "replace the rest rows" -> "replace the remaining rows"
- pandas_panel: add commas around the introductory phrase / before "as"
  to fix the run-on sentence about groupby axis=1 removal

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@mmcky mmcky merged commit 811accd into main Jun 19, 2026
5 checks passed
@mmcky mmcky deleted the update-pandas-3.0 branch June 19, 2026 03:06
@mmcky

mmcky commented Jun 19, 2026

Copy link
Copy Markdown
Contributor Author

✅ Translation sync completed (zh-cn)

Target repo: QuantEcon/lecture-python-programming.zh-cn
Translation PR: QuantEcon/lecture-python-programming.zh-cn#67
Files synced (2):

  • lectures/pandas.md
  • lectures/pandas_panel.md

@mmcky

mmcky commented Jun 19, 2026

Copy link
Copy Markdown
Contributor Author

✅ Translation sync completed (fa)

Target repo: QuantEcon/lecture-python-programming.fa
Translation PR: QuantEcon/lecture-python-programming.fa#127
Files synced (2):

  • lectures/pandas.md
  • lectures/pandas_panel.md

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