Skip to content

Sync pandas-fast-flexible-intuitive with the updated tutorial - #857

Open
realpython-bot wants to merge 3 commits into
masterfrom
maintenance/fast-flexible-pandas-20260921
Open

realpython-bot wants to merge 3 commits into
masterfrom
maintenance/fast-flexible-pandas-20260921

Conversation

@realpython-bot

@realpython-bot realpython-bot commented Sep 21, 2026 •

Copy link
Copy Markdown
Collaborator

Companion sync for the full update of "Fast, Flexible, Easy and Intuitive: How to Speed Up Your pandas Projects".

The tutorial's dependencies field moved from pandas==0.23.3 / python==3.7 to pandas==3.1.2 / numpy==2.5.5 / tables==3.11.1 / python==3.14, so this folder needed to catch up.

What changed

  • requirements.txt (new) — pins the versions the article now targets: pandas==3.1.2, numpy==2.5.5, tables==3.11.1. The folder had no file a reader could install from.
  • README.md — the sample output was recorded on Python 3.6.6 / pandas 0.23.2 in 2018. Replaced with a real run on Python 3.14.10 / pandas 3.1.2, and added the install step for the new requirements.txt.
  • tutorial/__main__.py
    • pd.cut() now uses right=False instead of include_lowest=True, so hours 7 and 17 land in the same tariff as the other five functions (the old bins mis-priced 730 of 8,760 rows). Matches the article's fix.
    • df = df.set_index("date_time") instead of set_index(..., inplace=True), which pandas 3.1 deprecates (PDEP-8, Pandas4Warning).
    • The comment above convert() said "object dtype"; pandas 3.0+ reads the column as str.
    • Removed the dead mode.chained_assignment option (no effect since pandas 3.0, deprecated in 3.1).

How it was verified

  • Fresh venv on Python 3.14.10 with the new pins, then python -m tutorial end to end with -W error::DeprecationWarning -W error::FutureWarning — exit 0, all eight timing functions ran, no Pandas4Warning.
  • All six apply_tariff_* functions produce the same total (114,916.492 cents) on the article's demand_profile.csv.
  • ruff@0.14.1 format --check pandas-fast-flexible-intuitive → 3 files already formatted.
  • ruff@0.14.1 check pandas-fast-flexible-intuitive → all checks passed.
  • .github/workflows/dircheck.py → passed.

Links

🤖 Generated with Claude Code

martin-martin and others added 3 commits September 21, 2026 06:19
…ast, Flexible, Easy and Intuitive: How to Speed Up Your pandas Projects'
include_lowest=True with right-closed bins put hours 7 and 17 in the
wrong tariff (730 of 8,760 rows). right=False matches the other five
functions. Also drop the mode.chained_assignment option, which has had
no effect since pandas 3.0 and is deprecated in pandas 3.1.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…e set_index

- requirements.txt: pandas==3.1.2, numpy==2.5.5, tables==3.11.1 (the
  article's dependencies field after the pandas 3.1 refresh)
- tutorial/__main__.py: df = df.set_index("date_time") instead of
  inplace=True, which pandas 3.1 deprecates (PDEP-8, Pandas4Warning)
- README.md: sample output re-recorded on Python 3.14.10 / pandas 3.1.2

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>

This branch has not been deployed

No deployments
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.

3 participants