df.filter()
df.filter([..])
selects rows based on the given conditions.
Setup
import numpy as np
import pandas as pd
import polars as pl
np.random.seed(42)
data = {"nrs": [1, 2, 3, 4, 5], "random": np.random.rand(5)}
Example
The behavior of df.filter([..])
can be treated as df.query(..)
in Pandas
.
Reference
The examples in this section have been adapted from the Polars
user guide.