class_docstr: Namespace for expressions that operate on expression names.
docstr: Add a prefix to the root column name of the expression.
  
  Parameters
  ----------
  prefix
      Prefix to add to the root column name.
  
  Notes
  -----
  This will undo any previous renaming operations on the expression.
  
  Due to implementation constraints, this method can only be called as the last
  expression in a chain.
  
  See Also
  --------
  suffix
  
  Examples
  --------
  >>> df = pl.DataFrame(
  ...     {
  ...         "a": [1, 2, 3],
  ...         "b": ["x", "y", "z"],
  ...     }
  ... )
  >>> df.with_columns(pl.all().reverse().name.prefix("reverse_"))
  shape: (3, 4)
  ┌─────┬─────┬───────────┬───────────┐
  │ a   ┆ b   ┆ reverse_a ┆ reverse_b │
  │ --- ┆ --- ┆ ---       ┆ ---       │
  │ i64 ┆ str ┆ i64       ┆ str       │
  ╞═════╪═════╪═══════════╪═══════════╡
  │ 1   ┆ x   ┆ 3         ┆ z         │
  │ 2   ┆ y   ┆ 2         ┆ y         │
  │ 3   ┆ z   ┆ 1         ┆ x         │
  └─────┴─────┴───────────┴───────────┘
docstr_tok: ["Add","a","prefix","to","the","root","column","name","of","the","expression",".","Parameters","--","--","--","--","--","prefix","Prefix","to","add","to","the","root","column","name",".","Notes","--","--","-","This","will","undo","any","previous","renaming","operations","on","the","expression",".","Due","to","implementation","constraints",",","this","method","can","only","be","called","as","the","last","expression","in","a","chain",".","See","Also","--","--","--","--","suffix","Examples","--","--","--","--",">",">",">","df","=","pl.DataFrame","(","...","{","...","``","a","''",":","[","1",",","2",",","3","]",",","...","``","b","''",":","[","``","x","''",",","``","y","''",",","``","z","''","]",",","...","}","...",")",">",">",">","df.with_columns","(","pl.all","(",")",".reverse","(",")",".name.prefix","(","``","reverse_","''",")",")","shape",":","(","3",",","4",")","\u250c\u2500\u2500\u2500\u2500\u2500\u252c\u2500\u2500\u2500\u2500\u2500\u252c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u252c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2510","\u2502","a","\u2506","b","\u2506","reverse_a","\u2506","reverse_b","\u2502","\u2502","--","-","\u2506","--","-","\u2506","--","-","\u2506","--","-","\u2502","\u2502","i64","\u2506","str","\u2506","i64","\u2506","str","\u2502","\u255e\u2550\u2550\u2550\u2550\u2550\u256a\u2550\u2550\u2550\u2550\u2550\u256a\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u256a\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2561","\u2502","1","\u2506","x","\u2506","3","\u2506","z","\u2502","\u2502","2","\u2506","y","\u2506","2","\u2506","y","\u2502","\u2502","3","\u2506","z","\u2506","1","\u2506","x","\u2502","\u2514\u2500\u2500\u2500\u2500\u2500\u2534\u2500\u2500\u2500\u2500\u2500\u2534\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2534\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2518"]
code: def prefix(self, prefix: str) -> Expr:
      """
      Add a prefix to the root column name of the expression.
  
      Parameters
      ----------
      prefix
          Prefix to add to the root column name.
  
      Notes
      -----
      This will undo any previous renaming operations on the expression.
  
      Due to implementation constraints, this method can only be called as the last
      expression in a chain.
  
      See Also
      --------
      suffix
  
      Examples
      --------
      >>> df = pl.DataFrame(
      ...     {
      ...         "a": [1, 2, 3],
      ...         "b": ["x", "y", "z"],
      ...     }
      ... )
      >>> df.with_columns(pl.all().reverse().name.prefix("reverse_"))
      shape: (3, 4)
      ┌─────┬─────┬───────────┬───────────┐
      │ a   ┆ b   ┆ reverse_a ┆ reverse_b │
      │ --- ┆ --- ┆ ---       ┆ ---       │
      │ i64 ┆ str ┆ i64       ┆ str       │
      ╞═════╪═════╪═══════════╪═══════════╡
      │ 1   ┆ x   ┆ 3         ┆ z         │
      │ 2   ┆ y   ┆ 2         ┆ y         │
      │ 3   ┆ z   ┆ 1         ┆ x         │
      └─────┴─────┴───────────┴───────────┘
  
      """
      return self._from_pyexpr(self._pyexpr.name_prefix(prefix))
  
file_path: polars/py-polars/polars/expr/name.py
imports: from __future__ import annotations
  from typing import TYPE_CHECKING, Callable
label_desc: Use image node_id 4 for calling the ExprNameNameSpace obj's underlying member method code with example usage: obj.prefix(prefix) and returns: self