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-dtype for expression

Creates a selector that selects columns by data type.

Signature

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

Parameters

  • ...rest: Data types to select (e.g., i64, f64, str, bool)

Input/output types:

inputoutput
anypolars_selector

Examples

Create a selector for numeric columns

> polars selector by-dtype i64 f64

Double all integer columns using with-column

> [[a b c]; [1 2 "x"] [3 4 "y"]]
                    | polars into-df
                    | polars with-column ((polars selector by-dtype i64) * 2)
                    | polars collect
╭───┬───┬───┬───╮
│ # │ a │ b │ c │
├───┼───┼───┼───┤
│ 0 │ 2 │ 4 │ x │
│ 1 │ 6 │ 8 │ y │
╰───┴───┴───┴───╯