PyData & Scientific Libraries Stack

The Importance and Elegance of Polars Expressions

Talk

The Importance and Elegance of Polars Expressions - Session Card
Level: Novice Company/Institute: Posit

Abstract

Polars is known for its speed, but its elegance comes from its use of expressions. In this talk, we’ll explore how Polars expressions work and why they are key to efficient and elegant data manipulation. Through real-world examples, you’ll learn how to create, expand, and combine expressions in Polars to wrangle data more effectively.

Prerequisites

Attendees are expected to have experience with Python and Jupyter Notebooks. Experience with pandas is not required.

Description

Polars has gained popularity for its speed, but what truly makes it stand out is its syntax, especially the use of expressions. The book Python Polars: The Definitive Guide defines an expression as "a tree of operations that describe how to construct one or more Series." In this talk, we’ll demystify this concept, explaining how expressions make Polars an elegant tool for data manipulation.

We will cover:

  • Why expressions are crucial in Polars
  • A formal definition of an expression and what it means in practice
  • Creating expressions from existing columns or other values
  • Using expressions to select, filter, sort, and aggregate data
  • Applying expressions for aggregate statistics, mathematical transformations, and handling missing values
  • Combining expressions with operators, comparisons, and Boolean logic
  • A comparison of idiomatic vs. non-idiomatic Polars code

By the end of this talk, you’ll understand how to leverage Polars expressions to write cleaner and more efficient data manipulation code.

Speaker

Jeroen Janssens

Jeroen Janssens

Senior Developer Relations Engineer

Jeroen Janssens, PhD, is a Senior Developer Relations Engineer at Posit, PBC. His expertise lies in visualizing data, implementing machine learning models, and building solutions using Python, R, JavaScript, and Bash. He’s passionate about open source and sharing knowledge. He’s the author of Python Polars: The Definitive Guide (O’Reilly, 2025) and Data Science at the Command Line (O’Reilly, 2021). Jeroen holds a PhD in machine learning from Tilburg University and an MSc in artificial intelligence from Maastricht University. He lives with his wife and two kids in Rotterdam, the Netherlands.

View Full Conference Program