Real Python Logo

Episode 66: Practicing Python With CSV Files and Extracting Values With "filter()"

The Real Python Podcast

Jun 25, 2021 55m

Are you ready to practice your Python skills some more? There is a new set of practice problems prepared for you to tackle, and this time they’re based on working with CSV files. This week on the show, David Amos is back, and he’s brought another batch of PyCoder’s Weekly articles and projects.

Episode Sponsor:

David shares an article about functional programming with a focus on the “filter” function. The tutorial covers how to process an iterable and extract the items that satisfy a given condition. It also covers combining filter with other functional tools, and compares it to coding with Pythonic tools like list comprehensions and generator expressions.

We cover several other articles and projects from the Python community including, Excel, Python, and the future of data science, a Bayesian analysis of Lego prices in Python, why can’t comments appear after a line continuation character, teaching Python on the Raspberry Pi400 at the public library, a cross-platform editor designed for writing novels built with Python and Qt, and a text user interface with rich as the renderer.

Topics:

  • 00:00:00 – Introduction
  • 00:02:29 – Excel, Python, and the Future of Data Science
  • 00:07:50 – Python Practice Problems: Parsing CSV Files
  • 00:17:09 – Sponsor: Digital Ocean’s App Platform
  • 00:17:45 – A Bayesian Analysis of Lego Prices in Python With PyMC3
  • 00:23:02 – Why Can’t Comments Appear After a Line Continuation Character?
  • 00:28:40 – Python’s filter(): Extract Values From Iterables
  • 00:34:57 – Video Course Spotlight
  • 00:36:24 – How I Teach Python on the Raspberry Pi 400 at the Public Library
  • 00:46:23 – novelWriter: Cross-Platform Editor Designed for Writing Novels Built With Python and Qt
  • 00:48:02 – textual: A Text User Interface With Rich as the Renderer
  • 00:54:58 – Thanks and goodbye

Show Links:

Excel, Python, and the Future of Data Science – What’s the most widely used tool in data science? Is it pandas or NumPy? Is it the Python language itself? Not really. It’s Excel. You might argue that data scientists aren’t using Excel as their primary tool, and you might be right. But Excel enables non-technical users, like small business owners, to gain insights into their data. In this article, Anaconda CEO Peter Wang discusses his goal of making Python and PyData the “conceptual successor” to Excel.

Python Practice Problems: Parsing CSV Files – In this tutorial, you’ll prepare for future interviews by working through a set of Python practice problems that involve CSV files. You’ll work through the problems yourself and then compare your results with solutions developed by the Real Python team.

A Bayesian Analysis of Lego Prices in Python With PyMC3 – Follow along with this in-depth analysis of LEGO prices to see Bayesian analysis in action. Along the way, you’ll how pooled and unpooled linear models can be used to determine if a LEGO set is fairly priced. The article is quite technical, so experience with Bayesian statistics is recommended.

Why Can’t Comments Appear After a Line Continuation Character? – Chaining together many object methods can create long tines that break the PEP 8 79-character line length recommendation. You can use \ to break the chain of methods onto individual lines, but if you want to leave comments at the end of some of the lines, you’re out of luck. There’s another pattern, though, that solves this.

Python’s filter(): Extract Values From Iterables – In this step-by-step tutorial, you’ll learn how Python’s filter() works and how to use it effectively in your programs. You’ll also learn how to use list comprehension and generator expressions to replace filter() and make your code more Pythonic.

How I Teach Python on the Raspberry Pi 400 at the Public Library – Community-based programming courses are a great way to introduce folks to computer programming that otherwise may not have the means to do so. One of the barriers to learning to code is cost. You need a computer to program on, after all. But with the advent of tiny computers like the Raspberry Pi, computers aimed at education are more affordable than ever.

Projects:

Additional Links: