On this page:
1.1 Getting started
1.2 Concepts
1.3 Expressions
1.4 IO
1.5 Interoperability
9.3

1 User guide🔗ℹ

Every snippet has a runnable counterpart under user-guide/<chapter>/ in the project repository, paired with the equivalent Python program:

racket user-guide/getting-started/expressions-and-contexts.rkt

python user-guide/getting-started/expressions_and_contexts.py

Snippets use the fluent, thread-first style: each verb takes the frame — or the expression — as its first argument, and ~> (re-provided by polars) chains them, within an expression as much as across frames. Where the bindings have no spelling for an upstream call, the chapter says so and shows the nearest workaround. For the definition of every binding mentioned, see the Reference.

1.1 Getting started🔗ℹ

See Operators and pipelines for the definition of every verb used here.

    1.1.1 Installing

    1.1.2 Reading & writing

    1.1.3 Expressions and contexts

      1.1.3.1 select

      1.1.3.2 with-columns

      1.1.3.3 filter

      1.1.3.4 group-by

      1.1.3.5 More complex queries

    1.1.4 Combining dataframes

      1.1.4.1 Joining

      1.1.4.2 Concatenating

1.2 Concepts🔗ℹ

See Operators and pipelines for the operators and contexts used here.

    1.2.1 Data types and structures

      1.2.1.1 Series

      1.2.1.2 Dataframe

        1.2.1.2.1 Inspecting a dataframe

      1.2.1.3 Schema

      1.2.1.4 Data types

    1.2.2 Expressions and contexts

      1.2.2.1 Expressions

      1.2.2.2 Contexts

        1.2.2.2.1 select

        1.2.2.2.2 with-columns

        1.2.2.2.3 filter

        1.2.2.2.4 group-by and aggregations

      1.2.2.3 Expression expansion

    1.2.3 Lazy API

1.3 Expressions🔗ℹ

See Operators and pipelines for col, all, exclude and over.

    1.3.1 Expression expansion

      1.3.1.1 Function col

        1.3.1.1.1 Explicit expansion by column name

        1.3.1.1.2 Expansion by data type

        1.3.1.1.3 Expansion by pattern matching

        1.3.1.1.4 Arguments cannot be of mixed types

      1.3.1.2 Selecting all columns

      1.3.1.3 Excluding columns

      1.3.1.4 Column renaming

        1.3.1.4.1 Renaming a single column with alias

        1.3.1.4.2 Prefixing and suffixing column names

        1.3.1.4.3 Dynamic name replacement

      1.3.1.5 Programmatically generating expressions

      1.3.1.6 More flexible column selections

        1.3.1.6.1 Debugging selectors

    1.3.2 Categorical data and enums

      1.3.2.1 Data type Enum

        1.3.2.1.1 Creating an Enum

        1.3.2.1.2 Invalid values

        1.3.2.1.3 Category ordering and comparison

      1.3.2.2 Data type Categorical

        1.3.2.2.1 Creating a Categorical series

        1.3.2.2.2 Using Categories objects

        1.3.2.2.3 Lexical comparison with strings

        1.3.2.2.4 Combining categorical columns

      1.3.2.3 Performance considerations

        1.3.2.3.1 Encodings

        1.3.2.3.2 Enum encodings are fixed

        1.3.2.3.3 Categorical encodings

    1.3.3 Window functions

      1.3.3.1 Operations per group

      1.3.3.2 Mapping results to dataframe rows

        1.3.3.2.1 group_to_rows

        1.3.3.2.2 explode

        1.3.3.2.3 join

      1.3.3.3 Windowed aggregation expressions

      1.3.3.4 More examples

1.4 IO🔗ℹ

See Operators and pipelines for read-csv, scan-csv and the other readers.

    1.4.1 CSV

      1.4.1.1 Read & write

      1.4.1.2 Scan

      1.4.1.3 Reading options

    1.4.2 Multiple files

      1.4.2.1 Reading into a single dataframe

      1.4.2.2 Reading and processing in parallel

1.5 Interoperability🔗ℹ

See Converting to Racket values for every conversion used here.

Handing Polars data to Racket code that is not Polars: a loop, a numeric routine, a foreign solver, a plot. The chapter mirrors upstream’s Arrow producer/consumer and Visualization pages, with the Python export calls those pages lean on: Series.to_list, Series.to_numpy, DataFrame.to_dict and DataFrame.to_numpy.

    1.5.1 Series to Racket values

    1.5.2 Iterating

    1.5.3 Columns as Racket data

    1.5.4 Numeric buffers

    1.5.5 Data for a plot