pola-rs / polars

Dataframes powered by a multithreaded, vectorized query engine, written in Rust
https://docs.pola.rs
Other
28.23k stars 1.75k forks source link

Add section about using `pipe` to the user guide #16461

Open KDruzhkin opened 2 months ago

KDruzhkin commented 2 months ago

Description

There have been at least two independent proposals to add the .assert method on DataFrames and Series.

As @stinodego explained in a comment https://github.com/pola-rs/polars/issues/14620#issuecomment-2126888941, one can already do this using pipes.

Maybe, debugging with pipes deserves a more prominent place in the docs?

The user guide mentions pipes only in passing (Pipe littering: "Don't").

Link

No response

stinodego commented 2 months ago

It makes sense to add a dedicated section for pipe in the docs, as it's a useful tool for doing custom things. It happens more often that I point out "you can do this with pipe" and people didn't know that method existed.

Not sure I would call it 'debugging with pipe' though. It's useful for more than just debugging.

A "Pipe" page could be added to the "Transformations" section. This could showcase common patterns for using pipe. The schema assertion could be one, but a more important pattern is when you want to "name" some custom transformations and use them in a chaining fashion. We can include examples for Expr, DataFrame, and LazyFrame.