I know polars does not support index by design, so df.filter(expr).index isn't an option, another way I can think of is by adding a new column before applying any filters, not sure if this is an optimal way for doing so in polars
df.with_column(pl.Series('index', range(len(df))).filter(expr).index