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 selector by-name for expression

Creates a selector that selects columns by name.

Signature

> polars selector by-name {flags} ...rest

Parameters

  • ...rest: Names of columns to select

Input/output types:

inputoutput
anypolars_selector

Examples

Create a selector for columns by name

> polars selector by-name foo bar

Add 10 to specific columns using with-column

> [[a b c]; [1 2 3] [4 5 6]]
                    | polars into-df
                    | polars with-column ((polars selector by-name a c) + 10)
                    | polars collect
╭───┬────┬───┬────╮
│ # │ a  │ b │ c  │
├───┼────┼───┼────┤
│ 0 │ 11 │ 2 │ 13 │
│ 1 │ 14 │ 5 │ 16 │
╰───┴────┴───┴────╯