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

Select columns whose names consist entirely of digit characters. By default uses Unicode decimal digits; use `--ascii-only` to restrict to ASCII 0-9.

Signature

> polars selector digit {flags}

Flags

  • --ascii-only, -a: Restrict to ASCII digit characters (0-9) only.

Input/output types:

inputoutput
anypolars_selector

Examples

Select columns whose names consist entirely of digits

> {
    "123": [1, 2],
    "abc": [3, 4],
    "4": [5, 6],
} |
polars into-df --as-columns |
polars select (polars selector digit) |
polars sort-by "123" "4" |
polars collect
╭───┬─────┬───╮
│ # │ 123 │ 4 │
├───┼─────┼───┤
│ 0 │   1 │ 5 │
│ 1 │   2 │ 6 │
╰───┴─────┴───╯

Select digit-named columns using ASCII digits only

> {
    "123": [1, 2],
    "abc": [3, 4],
} |
polars into-df --as-columns |
polars select (polars selector digit --ascii-only) |
polars collect
╭───┬─────╮
│ # │ 123 │
├───┼─────┤
│ 0 │   1 │
│ 1 │   2 │
╰───┴─────╯