class_docstr: Namespace for string related expressions.
class_docstr_tok: ["Namespace","for","string","related","expressions","."]
docstr: Split the string by a substring using `n` splits.
  
  Results in a struct of `n+1` fields.
  
  If it cannot make `n` splits, the remaining field elements will be null.
  
  Parameters
  ----------
  by
      Substring to split by.
  n
      Number of splits to make.
  inclusive
      If True, include the split character/string in the results.
  
  Returns
  -------
  Expr
      Expression of data type :class:`Struct` with fields of data type
      :class:`String`.
  
  Examples
  --------
  >>> df = pl.DataFrame({"x": ["a_1", None, "c", "d_4"]})
  >>> df.with_columns(
  ...     extracted=pl.col("x").str.split_exact("_", 1).alias("fields"),
  ... )
  shape: (4, 2)
  ┌──────┬─────────────┐
  │ x    ┆ extracted   │
  │ ---  ┆ ---         │
  │ str  ┆ struct[2]   │
  ╞══════╪═════════════╡
  │ a_1  ┆ {"a","1"}   │
  │ null ┆ {null,null} │
  │ c    ┆ {"c",null}  │
  │ d_4  ┆ {"d","4"}   │
  └──────┴─────────────┘
  
  
  Split string values in column x in exactly 2 parts and assign
  each part to a new column.
  
  >>> df.with_columns(
  ...     [
  ...         pl.col("x")
  ...         .str.split_exact("_", 1)
  ...         .struct.rename_fields(["first_part", "second_part"])
  ...         .alias("fields"),
  ...     ]
  ... ).unnest("fields")
  shape: (4, 3)
  ┌──────┬────────────┬─────────────┐
  │ x    ┆ first_part ┆ second_part │
  │ ---  ┆ ---        ┆ ---         │
  │ str  ┆ str        ┆ str         │
  ╞══════╪════════════╪═════════════╡
  │ a_1  ┆ a          ┆ 1           │
  │ null ┆ null       ┆ null        │
  │ c    ┆ c          ┆ null        │
  │ d_4  ┆ d          ┆ 4           │
  └──────┴────────────┴─────────────┘
docstr_tok: ["Split","the","string","by","a","substring","using","`","n","`","splits",".","Results","in","a","struct","of","`","n+1","`","fields",".","If","it","can","not","make","`","n","`","splits",",","the","remaining","field","elements","will","be","null",".","Parameters","--","--","--","--","--","by","Substring","to","split","by",".","n","Number","of","splits","to","make",".","inclusive","If","True",",","include","the","split","character\/string","in","the","results",".","Returns","--","--","--","-","Expr","Expression","of","data","type",":","class",":","`","Struct","`","with","fields","of","data","type",":","class",":","`","String","`",".","Examples","--","--","--","--",">",">",">","df","=","pl.DataFrame","(","{","``","x","''",":","[","``","a_1","''",",","None",",","``","c","''",",","``","d_4","''","]","}",")",">",">",">","df.with_columns","(","...","extracted=pl.col","(","``","x","''",")",".str.split_exact","(","``","_","''",",","1",")",".alias","(","``","fields","''",")",",","...",")","shape",":","(","4",",","2",")","\u250c\u2500\u2500\u2500\u2500\u2500\u2500\u252c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2510","\u2502","x","\u2506","extracted","\u2502","\u2502","--","-","\u2506","--","-","\u2502","\u2502","str","\u2506","struct","[","2","]","\u2502","\u255e\u2550\u2550\u2550\u2550\u2550\u2550\u256a\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2561","\u2502","a_1","\u2506","{","``","a","''",",","''","1","''","}","\u2502","\u2502","null","\u2506","{","null",",","null","}","\u2502","\u2502","c","\u2506","{","``","c","''",",","null","}","\u2502","\u2502","d_4","\u2506","{","``","d","''",",","''","4","''","}","\u2502","\u2514\u2500\u2500\u2500\u2500\u2500\u2500\u2534\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2518","Split","string","values","in","column","x","in","exactly","2","parts","and","assign","each","part","to","a","new","column",".",">",">",">","df.with_columns","(","...","[","...","pl.col","(","``","x","''",")","...",".str.split_exact","(","``","_","''",",","1",")","...",".struct.rename_fields","(","[","``","first_part","''",",","``","second_part","''","]",")","...",".alias","(","``","fields","''",")",",","...","]","...",")",".unnest","(","``","fields","''",")","shape",":","(","4",",","3",")","\u250c\u2500\u2500\u2500\u2500\u2500\u2500\u252c\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\u2510","\u2502","x","\u2506","first_part","\u2506","second_part","\u2502","\u2502","--","-","\u2506","--","-","\u2506","--","-","\u2502","\u2502","str","\u2506","str","\u2506","str","\u2502","\u255e\u2550\u2550\u2550\u2550\u2550\u2550\u256a\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\u2561","\u2502","a_1","\u2506","a","\u2506","1","\u2502","\u2502","null","\u2506","null","\u2506","null","\u2502","\u2502","c","\u2506","c","\u2506","null","\u2502","\u2502","d_4","\u2506","d","\u2506","4","\u2502","\u2514\u2500\u2500\u2500\u2500\u2500\u2500\u2534\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\u2518"]
code: def split_exact(
      self, by: IntoExpr, n: int, *, inclusive: bool = False
  ) -> Expr:
      """
      Split the string by a substring using `n` splits.
  
      Results in a struct of `n+1` fields.
  
      If it cannot make `n` splits, the remaining field elements will be null.
  
      Parameters
      ----------
      by
          Substring to split by.
      n
          Number of splits to make.
      inclusive
          If True, include the split character/string in the results.
  
      Returns
      -------
      Expr
          Expression of data type :class:`Struct` with fields of data type
          :class:`String`.
  
      Examples
      --------
      >>> df = pl.DataFrame({"x": ["a_1", None, "c", "d_4"]})
      >>> df.with_columns(
      ...     extracted=pl.col("x").str.split_exact("_", 1).alias("fields"),
      ... )
      shape: (4, 2)
      ┌──────┬─────────────┐
      │ x    ┆ extracted   │
      │ ---  ┆ ---         │
      │ str  ┆ struct[2]   │
      ╞══════╪═════════════╡
      │ a_1  ┆ {"a","1"}   │
      │ null ┆ {null,null} │
      │ c    ┆ {"c",null}  │
      │ d_4  ┆ {"d","4"}   │
      └──────┴─────────────┘
  
  
      Split string values in column x in exactly 2 parts and assign
      each part to a new column.
  
      >>> df.with_columns(
      ...     [
      ...         pl.col("x")
      ...         .str.split_exact("_", 1)
      ...         .struct.rename_fields(["first_part", "second_part"])
      ...         .alias("fields"),
      ...     ]
      ... ).unnest("fields")
      shape: (4, 3)
      ┌──────┬────────────┬─────────────┐
      │ x    ┆ first_part ┆ second_part │
      │ ---  ┆ ---        ┆ ---         │
      │ str  ┆ str        ┆ str         │
      ╞══════╪════════════╪═════════════╡
      │ a_1  ┆ a          ┆ 1           │
      │ null ┆ null       ┆ null        │
      │ c    ┆ c          ┆ null        │
      │ d_4  ┆ d          ┆ 4           │
      └──────┴────────────┴─────────────┘
  
      """
      by = parse_as_expression(by, str_as_lit=True)
      if inclusive:
          return wrap_expr(
              self._pyexpr.str_split_exact_inclusive(by, n)
          )
      return wrap_expr(self._pyexpr.str_split_exact(by, n))
  
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 33 for calling the ExprStringNameSpace obj's underlying member method code with example usage: obj.split_exact(by, n) and returns: wrap_expr, wrap_expr