[pandas, pandas_panel] Update lectures for pandas 3.0 compatibility#470
Merged
Conversation
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>
Contributor
There was a problem hiding this comment.
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 inpandas.mdto use defaultNaNfill behavior instead of insertingFalseacross non-matching rows. - Remove now-unnecessary
future_stack=Truefrom.stack()calls inpandas_panel.mdand update wording aboutgroupby(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. |
- 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>
Contributor
Author
✅ Translation sync completed (zh-cn)Target repo: QuantEcon/lecture-python-programming.zh-cn
|
Contributor
Author
✅ Translation sync completed (fa)Target repo: QuantEcon/lecture-python-programming.fa
|
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.
Summary
Updates
pandas.mdandpandas_panel.mdfor compatibility with pandas 3.0 (What's New).Rebased on current
main, which now ships pandas 3.0.3 viaanaconda=2026.06(#562). The earlier interimpandas>=3pip pin andanaconda=2025.12are therefore no longer needed, so this PR now carries only the lecture changes — noenvironment.ymlchange.Changes
pandas_panel.mdfuture_stack=Truefrom all.stack()calls — the new stacking layout is the default in pandas 3.0.groupbyaxis=1support is now described as "removed" (not "deprecated"); it is fully removed in 3.0. The lecture already uses the.T.groupby()pattern.pandas.mddf.where(df.POP >= 20000, False)→df.where(df.POP >= 20000)so the example fills non-matching rows withNaN(the standard.where()behaviour) instead of scatteringFalsethrough the string columns. Text updated to match.Validation
A full no-cache execution build under
anaconda=2026.06(pandas 3.0.3) was run viacache.yml; all 26 lectures execute. These lecture edits keep the pandas examples clean and free of the deprecatedfuture_stackkeyword.