Skip to content

Expressions

We introduced the concept of “expressions” in a previous section. In this section we will focus on exploring the types of expressions that Polars offers. Each section gives an overview of what they do and provides additional examples.

  • Essentials:
    • Basic operations – how to do basic operations on dataframe columns, like arithmetic calculations, comparisons, and other common, general-purpose operations
    • Expression expansion – what is expression expansion and how to use it
    • Casting – how to convert / cast values to different data types
  • How to work with specific types of data or data type namespaces:
    • Strings – how to work with strings and the namespace str
    • Lists and arrays – the differences between the data types List and Array, when to use them, and how to use them
    • Categorical data and enums – the differences between the data types Categorical and Enum, when to use them, and how to use them
    • Structs – when to use the data type Struct and how to use it
    • Missing data – how to work with missing data and how to fill missing data
  • Types of operations:
    • Aggregation – how to work with aggregating contexts like group_by
    • Window functions – how to apply window functions over columns in a dataframe
    • Folds – how to perform arbitrary computations horizontally across columns
  • User-defined Python functions – how to apply user-defined Python functions to dataframe columns or to column values
  • Numpy functions – how to use NumPy native functions on Polars dataframes and series