rt_frame_equal.html)
    * [ polars.testing.assert_frame_not_equal ](../../api/polars.testing.assert_frame_not_equal.html)
    * [ polars.testing.assert_series_equal ](../../api/polars.testing.assert_series_equal.html)
    * [ polars.testing.assert_series_not_equal ](../../api/polars.testing.assert_series_not_equal.html)
    * [ polars.testing.parametric.dataframes ](../../api/polars.testing.parametric.dataframes.html)
    * [ polars.testing.parametric.series ](../../api/polars.testing.parametric.series.html)
    * [ polars.testing.parametric.column ](../../api/polars.testing.parametric.column.html)
    * [ polars.testing.parametric.columns ](../../api/polars.testing.parametric.columns.html)
    * [ polars.testing.parametric.create_list_strategy ](../../api/polars.testing.parametric.create_list_strategy.html)
    * [ polars.testing.parametric.load_profile ](../../api/polars.testing.parametric.load_profile.html)
    * [ polars.testing.parametric.set_profile ](../../api/polars.testing.parametric.set_profile.html)

  * [ Metadata ](../../metadata.html) __
    * [ polars.build_info ](../../api/polars.build_info.html)
    * [ polars.get_index_type ](../../api/polars.get_index_type.html)
    * [ polars.show_versions ](../../api/polars.show_versions.html)
    * [ polars.thread_pool_size ](../../api/polars.thread_pool_size.html)
    * [ polars.threadpool_size ](../../api/polars.threadpool_size.html)

  * [ __ ](../../../index.html)
  * [ Python API reference ](../../index.html)
  * __
  * [ Columns / names ](../columns.html)
  * polars.Expr.... 

#  polars.Expr.map_alias  #

Expr.  map_alias  (  _ function  :  Callable  [  [  [ str
](https://docs.python.org/3/library/stdtypes.html#str "\(in Python v3.12\)") ]
,  [ str  ](https://docs.python.org/3/library/stdtypes.html#str "\(in Python
v3.12\)") ]  _ )  →  Self  [ [source]  ](https://github.com/pola-
rs/polars/blob/main/py-polars/polars/expr/expr.py#L709-L752) #

    

Rename the output of an expression by mapping a function over the root name.

Deprecated since version 0.19.12:  This method has been renamed to [ `
name.map()  ` ](polars.Expr.name.map.html#polars.Expr.name.map
"polars.Expr.name.map") .

Parameters  :

    

**function**

    

Function that maps a root name to a new name.

See also

[ ` keep_name  ` ](polars.Expr.keep_name.html#polars.Expr.keep_name
"polars.Expr.keep_name")

    
[ ` prefix  ` ](polars.Expr.prefix.html#polars.Expr.prefix
"polars.Expr.prefix")

    
[ ` suffix  ` ](polars.Expr.suffix.html#polars.Expr.suffix
"polars.Expr.suffix")

    

Examples

Remove a common suffix and convert to lower case.

    
    
    >>> df = pl.DataFrame(
    ...     {
    ...         "A_reverse": [3, 2, 1],
    ...         "B_reverse": ["z", "y", "x"],
    ...     }
    ... )
    >>> df.with_columns(
    ...     pl.all().reverse().name.map(lambda c: c.rstrip("_reverse").lower())
    ... )
    shape: (3, 4)
    ┌───────────┬───────────┬─────┬─────┐
    │ A_reverse ┆ B_reverse ┆ a   ┆ b   │
    │ ---       ┆ ---       ┆ --- ┆ --- │
    │ i64       ┆ str       ┆ i64 ┆ str │
    ╞═══════════╪═══════════╪═════╪═════╡
    │ 3         ┆ z         ┆ 1   ┆ x   │
    │ 2         ┆ y         ┆ 2   ┆ y   │
    │ 1         ┆ x         ┆ 3   ┆ z   │
    └───────────┴───────────┴─────┴─────┘
    

[ __ previous  polars.Expr.keep_name  ](polars.Expr.keep_name.html "previous
page") [ next  polars.Expr.prefix  __ ](polars.Expr.prefix.html "next page")

__ On this page

  * ` Expr.map_alias()  `

© Copyright 2020, Ritchie Vink.  

Created using [ Sphinx ](https://www.sphinx-doc.org/) 7.2.4.  

Built with the [ PyData Sphinx Theme ](https://pydata-sphinx-
theme.readthedocs.io/en/stable/index.html) 0.14.1.