polars math dot

For dataframe.

Compute the dot product of two column expressions.

warning This command requires a plugin The polars math dot command resides in the polars plugin. To use this command, you must install and register nu_plugin_polars. See the Plugins chapter in the book for more information.

Command Type

plugin

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 │
╰───┴───────╯

Ported from nushell/nushell.github.io. Copyright (c) 2021 Nushell Project. MIT License.