PyCon DE & PyData 2025

Power up your Polars code with Polars extention
2025-04-24 , Ferrum

While Polars is written in Rust and has the advantages of speed and multi-threaded functionalities., everything will slow down if a Python function needs to be applied to the DataFrame. To avoid that, a Polar extension can be used to solve the problem. In this workshop, we will look at how to do it.


We love Polars because it is written in Rust so we can use Rust's security and speed. However, it is not the most efficient if we still have to call in a Python function to perform specific aggregation. In this workshop, we will use the Polars plugin. You will be writing simple functions in Rust, and then you will use it together with Polars in your Python data pipeline.

Target Audience

Engineers and data scientists who use Polars and are confident to write a bit of Rust code. We expect you to have knowledge of Python and Polars and have a bit of Rust experience (or be able to pick it up relatively quickly). Not all concepts in Rust will be explained but we will link to material where you can find explanations.

Goal

To empower Polars users who want to do more and do better with Polars. For folks who don't mind learning a new programming language, it is also a good opportunity to learn and practice writing in Rust.

Outline

  • Introduction (15 mins):
    1. What is Polars plugin
    2. How does it work (using Maturin to develop packages)
    3. How to use it with Polars (exercises)
  • Simple numerical functions (35 mins):
    1. Creating numerical functions with 1 input (exercise)
    2. Creating numerical functions with multiple inputs in the same row (exercise)
    3. Creating numerical functions that support multiple types (exercise)
  • Advance usage with Polars plugin (40 mins):
    1. Creating functions with multiple inputs across different rows (exercise)
    2. Functions with user-set parameters (exercise)
    3. Working with strings and lists (exercise)

Expected audience expertise: Domain:

Intermediate

Expected audience expertise: Python:

Intermediate

After having a career as a Data Scientist and Developer Advocate, Cheuk dedicated her work to the open-source community. Currently, she is working as AI developer advocate for JetBrains. She has co-founded Humble Data, a beginner Python workshop that has been happening around the world. She has served the EuroPython Society board for two years and is now a fellow and director of the Python Software Foundation.

This speaker also appears in: