σ
    ΰ'·hw)  γ                  σZ    S SK Jr  S SKJrJr  S SKJr  \(       a  S SKJr   " S S5      r	g)ι    )Ϊannotations)ΪTYPE_CHECKINGΪCallable)Ϊ	wrap_expr)ΪExprc                  σ    \ rS rSrSrSrSS jrSS jrSS jrSS jr	SS jr
SS	 jrSS
 jrSS jrSS jrSS jrSrg)ΪExprNameNameSpaceι   z;Namespace for expressions that operate on expression names.Ϊnamec                σ&    UR                   U l         g )N©Ϊ_pyexpr)ΪselfΪexprs     ΪcC:\Users\julio\OneDrive\Documentos\Trabajo\Ideas Frescas\venv\Lib\site-packages\polars/expr/name.pyΪ__init__ΪExprNameNameSpace.__init__   s    Ψ||σ    c                σH    [        U R                  R                  5       5      $ )u΅  
Keep the original root name of the expression.

See Also
--------
Expr.alias
map

Examples
--------
Prevent errors due to potential duplicate column names.

>>> df = pl.DataFrame(
...     {
...         "a": [1, 2],
...         "b": [3, 4],
...     }
... )
>>> df.select((pl.lit(10) / pl.all()).name.keep())
shape: (2, 2)
ββββββββ¬βββββββββββ
β a    β b        β
β ---  β ---      β
β f64  β f64      β
ββββββββͺβββββββββββ‘
β 10.0 β 3.333333 β
β 5.0  β 2.5      β
ββββββββ΄βββββββββββ

Undo an alias operation.

>>> df.with_columns((pl.col("a") * 9).alias("c").name.keep())
shape: (2, 2)
βββββββ¬ββββββ
β a   β b   β
β --- β --- β
β i64 β i64 β
βββββββͺββββββ‘
β 9   β 3   β
β 18  β 4   β
βββββββ΄ββββββ
)r   r   Ϊ	name_keep©r   s    r   ΪkeepΪExprNameNameSpace.keep   s    τV Χ/Ρ/Σ1Σ2Π2r   c                σJ    [        U R                  R                  U5      5      $ )u  
Rename the output of an expression by mapping a function over the root name.

Parameters
----------
function
    Function that maps a root name to a new name.

See Also
--------
keep
prefix
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.removesuffix("_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   β
βββββββββββββ΄ββββββββββββ΄ββββββ΄ββββββ
)r   r   Ϊname_map©r   Ϊfunctions     r   ΪmapΪExprNameNameSpace.map@   s    τR Χ.Ρ.¨xΣ8Σ9Π9r   c                σJ    [        U R                  R                  U5      5      $ )uΰ  
Add a prefix to the root column name of the expression.

Parameters
----------
prefix
    Prefix to add to the root column name.

See Also
--------
suffix
map

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         β
βββββββ΄ββββββ΄ββββββββββββ΄ββββββββββββ
)r   r   Ϊname_prefix©r   Ϊprefixs     r   r#   ΪExprNameNameSpace.prefixk   σ    τD Χ1Ρ1°&Σ9Σ:Π:r   c                σJ    [        U R                  R                  U5      5      $ )uΰ  
Add a suffix to the root column name of the expression.

Parameters
----------
suffix
    Suffix to add to the root column name.

See Also
--------
prefix
map

Examples
--------
>>> df = pl.DataFrame(
...     {
...         "a": [1, 2, 3],
...         "b": ["x", "y", "z"],
...     }
... )
>>> df.with_columns(pl.all().reverse().name.suffix("_reverse"))
shape: (3, 4)
βββββββ¬ββββββ¬ββββββββββββ¬ββββββββββββ
β a   β b   β a_reverse β b_reverse β
β --- β --- β ---       β ---       β
β i64 β str β i64       β str       β
βββββββͺββββββͺββββββββββββͺββββββββββββ‘
β 1   β x   β 3         β z         β
β 2   β y   β 2         β y         β
β 3   β z   β 1         β x         β
βββββββ΄ββββββ΄ββββββββββββ΄ββββββββββββ
)r   r   Ϊname_suffix©r   Ϊsuffixs     r   r)   ΪExprNameNameSpace.suffix   r%   r   c                σH    [        U R                  R                  5       5      $ )u  
Make the root column name lowercase.

See Also
--------
prefix
suffix
to_uppercase
map

Examples
--------
>>> df = pl.DataFrame(
...     {
...         "ColX": [1, 2, 3],
...         "ColY": ["x", "y", "z"],
...     }
... )
>>> df.with_columns(pl.all().name.to_lowercase())
shape: (3, 4)
ββββββββ¬βββββββ¬βββββββ¬βββββββ
β ColX β ColY β colx β coly β
β ---  β ---  β ---  β ---  β
β i64  β str  β i64  β str  β
ββββββββͺβββββββͺβββββββͺβββββββ‘
β 1    β x    β 1    β x    β
β 2    β y    β 2    β y    β
β 3    β z    β 3    β z    β
ββββββββ΄βββββββ΄βββββββ΄βββββββ
)r   r   Ϊname_to_lowercaser   s    r   Ϊto_lowercaseΪExprNameNameSpace.to_lowercase³   σ    τ> Χ7Ρ7Σ9Σ:Π:r   c                σH    [        U R                  R                  5       5      $ )u  
Make the root column name uppercase.

See Also
--------
prefix
suffix
to_lowercase
map

Examples
--------
>>> df = pl.DataFrame(
...     {
...         "ColX": [1, 2, 3],
...         "ColY": ["x", "y", "z"],
...     }
... )
>>> df.with_columns(pl.all().name.to_uppercase())
shape: (3, 4)
ββββββββ¬βββββββ¬βββββββ¬βββββββ
β ColX β ColY β COLX β COLY β
β ---  β ---  β ---  β ---  β
β i64  β str  β i64  β str  β
ββββββββͺβββββββͺβββββββͺβββββββ‘
β 1    β x    β 1    β x    β
β 2    β y    β 2    β y    β
β 3    β z    β 3    β z    β
ββββββββ΄βββββββ΄βββββββ΄βββββββ
)r   r   Ϊname_to_uppercaser   s    r   Ϊto_uppercaseΪExprNameNameSpace.to_uppercaseΤ   r/   r   c                σJ    [        U R                  R                  U5      5      $ )aΌ  
Rename fields of a struct by mapping a function over the field name(s).

Notes
-----
This only takes effect for struct columns.

Parameters
----------
function
    Function that maps a field name to a new name.

See Also
--------
prefix_fields
suffix_fields

Examples
--------
>>> df = pl.DataFrame({"x": {"a": 1, "b": 2}})
>>> df.select(pl.col("x").name.map_fields(lambda x: x.upper())).schema
Schema({'x': Struct({'A': Int64, 'B': Int64})})
)r   r   Ϊname_map_fieldsr   s     r   Ϊ
map_fieldsΪExprNameNameSpace.map_fieldsυ   s    τ0 Χ5Ρ5°hΣ?Σ@Π@r   c                σJ    [        U R                  R                  U5      5      $ )a  
Add a prefix to all field names of a struct.

Notes
-----
This only takes effect for struct columns.

Parameters
----------
prefix
    Prefix to add to the field name.

See Also
--------
map_fields
suffix_fields

Examples
--------
>>> df = pl.DataFrame({"x": {"a": 1, "b": 2}})
>>> df.select(pl.col("x").name.prefix_fields("prefix_")).schema
Schema({'x': Struct({'prefix_a': Int64, 'prefix_b': Int64})})
)r   r   Ϊname_prefix_fieldsr"   s     r   Ϊprefix_fieldsΪExprNameNameSpace.prefix_fields  σ    τ0 Χ8Ρ8ΈΣ@ΣAΠAr   c                σJ    [        U R                  R                  U5      5      $ )a  
Add a suffix to all field names of a struct.

Notes
-----
This only takes effect for struct columns.

Parameters
----------
suffix
    Suffix to add to the field name.

See Also
--------
map_fields
prefix_fields

Examples
--------
>>> df = pl.DataFrame({"x": {"a": 1, "b": 2}})
>>> df.select(pl.col("x").name.suffix_fields("_suffix")).schema
Schema({'x': Struct({'a_suffix': Int64, 'b_suffix': Int64})})
)r   r   Ϊname_suffix_fieldsr(   s     r   Ϊsuffix_fieldsΪExprNameNameSpace.suffix_fields)  r<   r   r   N)r   r   ΪreturnΪNone)rA   r   )r   zCallable[[str], str]rA   r   )r#   ΪstrrA   r   )r)   rC   rA   r   )Ϊ__name__Ϊ
__module__Ϊ__qualname__Ϊ__firstlineno__Ϊ__doc__Ϊ	_accessorr   r   r   r#   r)   r-   r2   r6   r:   r?   Ϊ__static_attributes__© r   r   r	   r	      sE    ΩEΰIτ$τ+3τZ):τV";τH";τH;τB;τBAτ4Bχ4Br   r	   N)
Ϊ
__future__r   Ϊtypingr   r   Ϊpolars._utils.wrapr   Ϊpolarsr   r	   rK   r   r   Ϊ<module>rP      s"   πέ "η *ε (ζέχvBς vBr   