polars math dot for dataframe
Compute the dot product of two column expressions.
Signature
> polars math dot {flags} (other)
Parameters
other: Expression to compute dot product with.
Input/output types:
| input | output |
|---|---|
| polars_expression | polars_expression |
| polars_selector | polars_expression |
Examples
Compute the dot product of two integer columns
> [[a b]; [0 0] [1 1] [2 2] [3 3] [4 4] [5 5]] |
polars into-df |
polars select (polars col a | polars math dot (polars col b) | polars as ab) |
polars collect
╭───┬───────╮
│ # │ ab │
├───┼───────┤
│ 0 │ 55.00 │
╰───┴───────╯