Skip to content

Commit

Permalink
Couple of minor fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Wainberg authored Jan 7, 2024
1 parent aea1d55 commit 44b8848
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion docs/user-guide/concepts/contexts.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ When some expressions produce length-1 `Series` and some do not, the length-1 `S

As you can see from the query the `select` context is very powerful and allows you to evaluate arbitrary expressions independent of (and in parallel to) each other.

The other selection context is `with_columns`. The main difference between `select` and `with_columns` is that `with_columns` retains the original columns and adds new ones, whereas `select` drops the original columns. The other difference is that `with_columns` always yields a `DataFrame` of the same length as the original, so broadcasting will occur even if every `Series` produced has a length of 1. For instance, `df.select(pl.all().sum())` results in a length-1 DataFrame, whereas `df.with_columns(pl.all().sum())` broadcasts each of the sums to the length of the original `DataFrame`.
The other selection context is `with_columns`. The main difference between `with_columns` and `select` is that `with_columns` retains the original columns and adds new ones, whereas `select` drops the original columns. The other difference is that `with_columns` always yields a `DataFrame` of the same length as the original, so broadcasting will occur even if every `Series` produced has a length of 1. For instance, `df.select(pl.all().sum())` results in a length-1 `DataFrame`, whereas `df.with_columns(pl.all().sum())` broadcasts each of the sums to the length of the original `DataFrame`.

{{code_block('user-guide/concepts/contexts','with_columns',['with_columns'])}}

Expand Down

0 comments on commit 44b8848

Please sign in to comment.