class_docstr: Namespace for string related expressions.
class_docstr_tok: ["Namespace","for","string","related","expressions","."]
docstr: Split the string by a substring.
  
  Parameters
  ----------
  by
      Substring to split by.
  inclusive
      If True, include the split character/string in the results.
  
  Examples
  --------
  >>> df = pl.DataFrame({"s": ["foo bar", "foo_bar", "foo_bar_baz"]})
  >>> df.with_columns(
  ...     pl.col("s").str.split(by="_").alias("split"),
  ...     pl.col("s").str.split(by="_", inclusive=True).alias("split_inclusive"),
  ... )
  shape: (3, 3)
  ┌─────────────┬───────────────────────┬─────────────────────────┐
  │ s           ┆ split                 ┆ split_inclusive         │
  │ ---         ┆ ---                   ┆ ---                     │
  │ str         ┆ list[str]             ┆ list[str]               │
  ╞═════════════╪═══════════════════════╪═════════════════════════╡
  │ foo bar     ┆ ["foo bar"]           ┆ ["foo bar"]             │
  │ foo_bar     ┆ ["foo", "bar"]        ┆ ["foo_", "bar"]         │
  │ foo_bar_baz ┆ ["foo", "bar", "baz"] ┆ ["foo_", "bar_", "baz"] │
  └─────────────┴───────────────────────┴─────────────────────────┘
  
  >>> df = pl.DataFrame(
  ...     {"s": ["foo^bar", "foo_bar", "foo*bar*baz"], "by": ["_", "_", "*"]}
  ... )
  >>> df.with_columns(
  ...     pl.col("s").str.split(by=pl.col("by")).alias("split"),
  ...     pl.col("s")
  ...     .str.split(by=pl.col("by"), inclusive=True)
  ...     .alias("split_inclusive"),
  ... )
  shape: (3, 4)
  ┌─────────────┬─────┬───────────────────────┬─────────────────────────┐
  │ s           ┆ by  ┆ split                 ┆ split_inclusive         │
  │ ---         ┆ --- ┆ ---                   ┆ ---                     │
  │ str         ┆ str ┆ list[str]             ┆ list[str]               │
  ╞═════════════╪═════╪═══════════════════════╪═════════════════════════╡
  │ foo^bar     ┆ _   ┆ ["foo^bar"]           ┆ ["foo^bar"]             │
  │ foo_bar     ┆ _   ┆ ["foo", "bar"]        ┆ ["foo_", "bar"]         │
  │ foo*bar*baz ┆ *   ┆ ["foo", "bar", "baz"] ┆ ["foo*", "bar*", "baz"] │
  └─────────────┴─────┴───────────────────────┴─────────────────────────┘
  
  Returns
  -------
  Expr
      Expression of data type :class:`String`.
docstr_tok: ["Split","the","string","by","a","substring",".","Parameters","--","--","--","--","--","by","Substring","to","split","by",".","inclusive","If","True",",","include","the","split","character\/string","in","the","results",".","Examples","--","--","--","--",">",">",">","df","=","pl.DataFrame","(","{","``","s","''",":","[","``","foo","bar","''",",","``","foo_bar","''",",","``","foo_bar_baz","''","]","}",")",">",">",">","df.with_columns","(","...","pl.col","(","``","s","''",")",".str.split","(","by=","''","_","''",")",".alias","(","``","split","''",")",",","...","pl.col","(","``","s","''",")",".str.split","(","by=","''","_","''",",","inclusive=True",")",".alias","(","``","split_inclusive","''",")",",","...",")","shape",":","(","3",",","3",")","\u250c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u252c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u252c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2510","\u2502","s","\u2506","split","\u2506","split_inclusive","\u2502","\u2502","--","-","\u2506","--","-","\u2506","--","-","\u2502","\u2502","str","\u2506","list","[","str","]","\u2506","list","[","str","]","\u2502","\u255e\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u256a\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u256a\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2561","\u2502","foo","bar","\u2506","[","``","foo","bar","''","]","\u2506","[","``","foo","bar","''","]","\u2502","\u2502","foo_bar","\u2506","[","``","foo","''",",","``","bar","''","]","\u2506","[","``","foo_","''",",","``","bar","''","]","\u2502","\u2502","foo_bar_baz","\u2506","[","``","foo","''",",","``","bar","''",",","``","baz","''","]","\u2506","[","``","foo_","''",",","``","bar_","''",",","``","baz","''","]","\u2502","\u2514\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2534\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2534\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2518",">",">",">","df","=","pl.DataFrame","(","...","{","``","s","''",":","[","``","foo^bar","''",",","``","foo_bar","''",",","``","foo","*","bar","*","baz","''","]",",","``","by","''",":","[","``","_","''",",","``","_","''",",","``","*","''","]","}","...",")",">",">",">","df.with_columns","(","...","pl.col","(","``","s","''",")",".str.split","(","by=pl.col","(","``","by","''",")",")",".alias","(","``","split","''",")",",","...","pl.col","(","``","s","''",")","...",".str.split","(","by=pl.col","(","``","by","''",")",",","inclusive=True",")","...",".alias","(","``","split_inclusive","''",")",",","...",")","shape",":","(","3",",","4",")","\u250c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u252c\u2500\u2500\u2500\u2500\u2500\u252c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u252c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2510","\u2502","s","\u2506","by","\u2506","split","\u2506","split_inclusive","\u2502","\u2502","--","-","\u2506","--","-","\u2506","--","-","\u2506","--","-","\u2502","\u2502","str","\u2506","str","\u2506","list","[","str","]","\u2506","list","[","str","]","\u2502","\u255e\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u256a\u2550\u2550\u2550\u2550\u2550\u256a\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u256a\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2561","\u2502","foo^bar","\u2506","_","\u2506","[","``","foo^bar","''","]","\u2506","[","``","foo^bar","''","]","\u2502","\u2502","foo_bar","\u2506","_","\u2506","[","``","foo","''",",","``","bar","''","]","\u2506","[","``","foo_","''",",","``","bar","''","]","\u2502","\u2502","foo","*","bar","*","baz","\u2506","*","\u2506","[","``","foo","''",",","``","bar","''",",","``","baz","''","]","\u2506","[","``","foo","*","''",",","``","bar","*","''",",","``","baz","''","]","\u2502","\u2514\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2534\u2500\u2500\u2500\u2500\u2500\u2534\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2534\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2518","Returns","--","--","--","-","Expr","Expression","of","data","type",":","class",":","`","String","`","."]
code: def split(self, by: IntoExpr, *, inclusive: bool = False) -> Expr:
      """
      Split the string by a substring.
  
      Parameters
      ----------
      by
          Substring to split by.
      inclusive
          If True, include the split character/string in the results.
  
      Examples
      --------
      >>> df = pl.DataFrame({"s": ["foo bar", "foo_bar", "foo_bar_baz"]})
      >>> df.with_columns(
      ...     pl.col("s").str.split(by="_").alias("split"),
      ...     pl.col("s").str.split(by="_", inclusive=True).alias("split_inclusive"),
      ... )
      shape: (3, 3)
      ┌─────────────┬───────────────────────┬─────────────────────────┐
      │ s           ┆ split                 ┆ split_inclusive         │
      │ ---         ┆ ---                   ┆ ---                     │
      │ str         ┆ list[str]             ┆ list[str]               │
      ╞═════════════╪═══════════════════════╪═════════════════════════╡
      │ foo bar     ┆ ["foo bar"]           ┆ ["foo bar"]             │
      │ foo_bar     ┆ ["foo", "bar"]        ┆ ["foo_", "bar"]         │
      │ foo_bar_baz ┆ ["foo", "bar", "baz"] ┆ ["foo_", "bar_", "baz"] │
      └─────────────┴───────────────────────┴─────────────────────────┘
  
      >>> df = pl.DataFrame(
      ...     {"s": ["foo^bar", "foo_bar", "foo*bar*baz"], "by": ["_", "_", "*"]}
      ... )
      >>> df.with_columns(
      ...     pl.col("s").str.split(by=pl.col("by")).alias("split"),
      ...     pl.col("s")
      ...     .str.split(by=pl.col("by"), inclusive=True)
      ...     .alias("split_inclusive"),
      ... )
      shape: (3, 4)
      ┌─────────────┬─────┬───────────────────────┬─────────────────────────┐
      │ s           ┆ by  ┆ split                 ┆ split_inclusive         │
      │ ---         ┆ --- ┆ ---                   ┆ ---                     │
      │ str         ┆ str ┆ list[str]             ┆ list[str]               │
      ╞═════════════╪═════╪═══════════════════════╪═════════════════════════╡
      │ foo^bar     ┆ _   ┆ ["foo^bar"]           ┆ ["foo^bar"]             │
      │ foo_bar     ┆ _   ┆ ["foo", "bar"]        ┆ ["foo_", "bar"]         │
      │ foo*bar*baz ┆ *   ┆ ["foo", "bar", "baz"] ┆ ["foo*", "bar*", "baz"] │
      └─────────────┴─────┴───────────────────────┴─────────────────────────┘
  
      Returns
      -------
      Expr
          Expression of data type :class:`String`.
  
      """
      by = parse_as_expression(by, str_as_lit=True)
      if inclusive:
          return wrap_expr(self._pyexpr.str_split_inclusive(by))
      return wrap_expr(self._pyexpr.str_split(by))
  
imports: from __future__ import annotations
  import warnings
  from typing import TYPE_CHECKING
  import polars._reexport
  from polars import functions
  from polars.datatypes import Date, Datetime, Int32, Time, py_type_to_dtype
  from polars.exceptions import ChronoFormatWarning
  from polars.utils._parse_expr_input import parse_as_expression
  from polars.utils._wrap import wrap_expr
  from polars.utils.deprecation import deprecate_renamed_function, deprecate_renamed_parameter, rename_use_earliest_to_ambiguous
  from polars.utils.various import find_stacklevel
label_desc: Use image node_id 32 for calling the ExprStringNameSpace obj's underlying member method code with example usage: obj.split(by) and returns: wrap_expr, wrap_expr