Method: Polars::StringNameSpace#join

Defined in:
lib/polars/string_name_space.rb

#join(delimiter = nil, ignore_nulls: true) ⇒ Series

Vertically concat the values in the Series to a single string value.

Examples:

Polars::Series.new([1, nil, 2]).str.join("-")
# =>
# shape: (1,)
# Series: '' [str]
# [
#         "1-2"
# ]
Polars::Series.new([1, nil, 2]).str.join("-", ignore_nulls: false)
# =>
# shape: (1,)
# Series: '' [str]
# [
#         null
# ]

Parameters:

  • delimiter (String) (defaults to: nil)

    The delimiter to insert between consecutive string values.

  • ignore_nulls (Boolean) (defaults to: true)

    Ignore null values (default). If set to false, null values will be propagated. This means that if the column contains any null values, the output is null.

Returns:



1497
1498
1499
1500
1501
1502
1503
1504
1505
# File 'lib/polars/string_name_space.rb', line 1497

def join(delimiter = nil, ignore_nulls: true)
  # TODO update
  if delimiter.nil?
    warn "The default `delimiter` for `join` method will change from `-` to empty string in a future version"
    delimiter = "-"
  end

  super
end