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 str-join for dataframe

Concatenates strings within a column or dataframes

This command requires a plugin

The polars str-join 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 str-join {flags} (other)

Flags

  • --delimiter, -d {string}: Delimiter to join strings within an expression. Other dataframe when used with a dataframe.
  • --ignore-nulls, -n: Ignore null values. Only available when used as an expression.

Parameters

  • other: Other dataframe with a single series of strings to be concatenated. Required when used with a dataframe, ignored when used as an expression.

Input/output types:

inputoutput
expressionexpression
dataframedataframe

Examples

Join strings in a column

> [[a]; [abc] [abc] [abc]] | polars into-df | polars select (polars col a | polars str-join -d ',') | polars collect
╭───┬─────────────╮
│ # │      a      │
├───┼─────────────┤
│ 0 │ abc,abc,abc │
╰───┴─────────────╯

StrJoin strings across two series

> let other = ([za xs cd] | polars into-df);
    [abc abc abc] | polars into-df | polars str-join $other
╭───┬───────╮
│ # │   0   │
├───┼───────┤
│ 0 │ abcza │
│ 1 │ abcxs │
│ 2 │ abccd │
╰───┴───────╯