Episode 162: Exploring the Zen of Python & pandas Features for Finance
The Real Python Podcast
Jun 30, 2023 50m
What advice can you extract from the Zen of Python? How can these nineteen guiding principles help you write more idiomatic Python? This week on the show, Christopher Trudeau is here, bringing another batch of PyCoder’s Weekly articles and projects.
Christopher shares a Real Python tutorial by Bartosz Zaczyński titled “What’s the Zen of Python?” We talk about the poem’s origin and ways to access the Zen within Python. We also discuss how different sections provide contradictory advice for what makes good Python code.
We cover a recent post by previous guest Matt Harrison about using Python and pandas for finance. Matt’s article covers methods in the pandas library for aggregation, resampling, and rolling averages.
We cover several other articles and projects from the Python community, including staying up-to-date with news, solving a Legend of Zelda puzzle with Python, avoiding “simply” providing advice, displaying better stack traces, and creating files with fake data.
Course Spotlight: Speed Up Python With Concurrency
Learn what concurrency means in Python and why you might want to use it. You’ll see a simple, non-concurrent approach and then look into why you’d want threading, asyncio, or multiprocessing.
Topics:
- 00:00:00 – Introduction
- 00:01:49 – Python 3.11.4, 3.10.12, 3.9.17, 3.8.17, 3.7.17, and Python 3.12.0 beta 3 released
- 00:02:24 – Enforcement of 2FA for PyPI Began June 1st
- 00:02:54 – Faster Python 3.13 Plan
- 00:03:14 – PyPy v7.3.12 Released
- 00:03:28 – Migrate to
.readthedocs.yaml
Configuration - 00:05:14 – PyCon US 2023 and PyCascades 2023 Videos Are Up
- 00:05:37 – What’s the Zen of Python?
- 00:09:22 – Python for Finance: Pandas Resample, Groupby, and Rolling
- 00:15:24 – Python and the Legend of Zelda
- 00:17:47 – Don’t Say “Simply” Use Pyenv, Poetry or Anaconda
- 00:28:54 – Is Parallel Programming Hard?
- 00:40:54 – Video Course Spotlight
- 00:42:20 – pymg: A Better Display for Stack Traces
- 00:44:58 – faker-file: Create Files With Fake Data
- 00:49:14 – Thanks and goodbye
News:
- Python 3.11.4, 3.10.12, 3.9.17, 3.8.17, 3.7.17, and 3.12.0 Beta 2 Released
- Python Insider: Python 3.12.0 beta 3 released
- Enforcement of 2FA for PyPI Began June 1st – For those accounts that have two-factor authentication turned on for PyPI uploads, the use of 2FA is now required. Users with 2FA who were only using a password in the past will now have to perform 2FA as well. This is all part of the PyPI transition to 2FA across the board.
- Faster Python 3.13 Plan – This brief outline highlights the plan for the faster CPython project for the 3.13 release. It includes PEP 669, PEP 554, improved memory management, and more. Here’s the associated Hacker News discussion.
- PyPy v7.3.12 Released
- Migrate to
.readthedocs.yaml
Configuration – The Read the Docs site has announced the new requirement that all builds must move to using a.readthedocs.yaml
configuration file, version 2. There are some test windows where they’ll be temporarily enforcing the change, but the final release date is September 25, 2023. Read on for details on how to migrate your project. - PyCascades 2023 Videos Are Up
- PyCon US 2023 Videos Are Up
Topic Links:
- What’s the Zen of Python? – In this tutorial, you’ll be exploring the Zen of Python, a collection of nineteen guiding principles for writing idiomatic Python. You’ll find out how they originated and whether you should follow them. Along the way, you’ll uncover several inside jokes associated with this humorous poem.
- Python for Finance: Pandas Resample, Groupby, and Rolling – When working with time series data such as financial information, the resample, grouping, and rolling features of pandas can make your life easier.
- Python and the Legend of Zelda – The Game Boy Color version of Legend of Zelda: Oracle of Ages contains a grid-based puzzle. Gaz writes about creating a brute-force program to solve the challenge using Python.
- Don’t Say “Simply” Use Pyenv, Poetry or Anaconda – This article talks about the issues that newer Python coders might encounter by adopting more complicated package management mechanisms and explains why sticking with
pip
is often the better choice.
Discussion:
- Is Parallel Programming Hard?
- AsyncIO: Why I Hate It – Charles is the creator of Peewee ORM and often gets the question when will it support
asyncio
? In this opinion piece, he talks about why he doesn’t likeasyncio
and which alternatives he prefers.
Projects:
Additional Links:
- Practicality Beats Purity: The Zen of Python’s Escape Hatch - Chris Neugebauer - YouTube
- Relieving your Python packaging pain
- Is Parallel Programming Hard, And, If So, What Can You Do About It? - Book Download