Nushell
Get Nu!
Getting Started
  • The Nushell Book
  • Command Reference
  • Cookbook
  • Language Reference Guide
  • Contributing Guide
Blog
  • English
  • 中文
  • Deutsch
  • Français
  • Español
  • 日本語
  • Português do Brasil
  • Русский язык
GitHub
Get Nu!
Getting Started
  • The Nushell Book
  • Command Reference
  • Cookbook
  • Language Reference Guide
  • Contributing Guide
Blog
  • English
  • 中文
  • Deutsch
  • Français
  • Español
  • 日本語
  • Português do Brasil
  • Русский язык
GitHub
  • Categories

    • Bits
    • Bytes
    • Chart
    • Conversions
    • Core
    • Database
    • Dataframe
    • Dataframe Or Lazyframe
    • Date
    • Debug
    • Default
    • Env
    • Experimental
    • Expression
    • Filesystem
    • Filters
    • Formats
    • Generators
    • Hash
    • History
    • Lazyframe
    • Math
    • Misc
    • Network
    • Path
    • Platform
    • Plugin
    • Prompt
    • Random
    • Removed
    • Shells
    • Strings
    • System
    • Viewers

polars over for lazyframe

Compute expressions over a window group defined by partition expressions.

This command requires a plugin

The polars over 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.

Signature

> polars over {flags} ...rest

Parameters

  • ...rest: Expression(s) that define the partition window

Input/output types:

inputoutput
anyany

Examples

Compute expression over an aggregation window

> [[a b]; [x 2] [x 4] [y 6] [y 4]]
        | polars into-lazy
        | polars select a (polars col b | polars cumulative sum | polars over a | polars as cum_b)
        | polars collect
╭───┬───┬───────╮
│ # │ a │ cum_b │
├───┼───┼───────┤
│ 0 │ x │     2 │
│ 1 │ x │     6 │
│ 2 │ y │     6 │
│ 3 │ y │    10 │
╰───┴───┴───────╯

Compute expression over an aggregation window where partitions are defined by expressions

> [[a b]; [x 2] [X 4] [Y 6] [y 4]]
        | polars into-lazy
        | polars select a (polars col b | polars cumulative sum | polars over (polars col a | polars lowercase) | polars as cum_b)
        | polars collect
╭───┬───┬───────╮
│ # │ a │ cum_b │
├───┼───┼───────┤
│ 0 │ x │     2 │
│ 1 │ X │     6 │
│ 2 │ Y │     6 │
│ 3 │ y │    10 │
╰───┴───┴───────╯