ó
    ŕ'ˇh˛ ă                  ó   S SK Jr  S SKrS SKrS SKrS SKrS SKJrJ	r	J
r
  S SKJr  S SKJr  S SKJr  S SKJrJrJrJrJr  S SKJs  Jr  S SKJr  S S	KJ r   S S
K!J"r"  S SK#J$r$J%r%  S SK&J'r'J(r(J)r)J*r*J+r+J,r,J-r-  S SK.J/r/  \R`                  " \15         S SK2J3r3J4r4  SSS5        \Rj                  S:ź  a  S SK6J7r7  O\8" S5      r7\(       a  S SKJ9r9  S SKJ:r:J;r;  S SK<J=r=J>r>J?r?  / SQr@\SLS j5       rA\SMS j5       rASNS jrASS.       SOS jjrBSPS jrCSS.           SQS jjrD      SRS  jrE " S! S\/5      rFSS".SSS# jjrGSTS$ jrHSTS% jrISUSS&.SVS' jjjrJ SUSS&.     SVS( jjjrKSTS) jrLSTS* jrM    SWS+ jrNSS,.     SXS- jjrOSS,.SYS. jjrP\"" 5       STS/ j5       rQ\"" 5       SZS[S0 jj5       rR\"" 5       SZSS1.S\S2 jjj5       rS\"" 5       STS3 j5       rT\"" 5       STS4 j5       rUSTS5 jrVS]S6 jrWSTS7 jrX  S^     S_S8 jjrSTS9 jrSUS`S: jjrY SZ   SaS; jjrZSbS< jr[      ScS= jr\SS.SdS> jjr]STS? jr^STS@ jr_STSA jr`STSB jraSS.SdSC jjrbSeSD jrcSTSE jrdSTSF jreSfSG jrfSSH.SgSI jjrgSTSJ jrhSTSK jrig! , (       d  f       GNç= f)hé    )ÚannotationsN)Ú
CollectionÚMappingÚSequence)ÚDecimal)Úreduce)Úor_)ÚTYPE_CHECKINGÚAnyÚLiteralÚNoReturnÚoverload)Ú	functions)Ú_parse_inputs_as_iterable)Úunstable)Ú	is_columnÚ	re_escape)ÚBinaryÚBooleanÚCategoricalÚDateÚStringÚTimeÚis_polars_dtype)ÚExpr)ÚPyExprÚ
PySelector)é   é
   )ÚNoneType)ÚIterable)Ú	DataFrameÚ	LazyFrame)ÚPolarsDataTypeÚPythonDataTypeÚTimeUnit)%ÚSelectorÚallÚalphaÚalphanumericÚarrayÚbinaryÚbooleanÚby_dtypeÚby_indexÚby_nameÚcategoricalÚcontainsÚdateÚdatetimeÚdecimalÚdigitÚdurationÚ	ends_withÚenumÚexcludeÚexpand_selectorÚfirstÚfloatÚintegerÚis_selectorÚlastÚlistÚmatchesÚnestedÚnumericÚsigned_integerÚstarts_withÚstringÚstructÚtemporalÚtimeÚunsigned_integerr'   c                ó    g ŠNŠ ŠÚobjs    ÚcC:\Users\julio\OneDrive\Documentos\Trabajo\Ideas Frescas\venv\Lib\site-packages\polars/selectors.pyr?   r?   ]   s    Ř14ó    c                ó    g rM   rN   rO   s    rQ   r?   r?   a   s    Ř-0rR   c                ó"    [        U [        5      $ )zň
Indicate whether the given object/expression is a selector.

Examples
--------
>>> from polars.selectors import is_selector
>>> import polars.selectors as cs
>>> is_selector(pl.col("colx"))
False
>>> is_selector(cs.first() | cs.last())
True
)Ú
isinstancer'   rO   s    rQ   r?   r?   e   s    ô c8Ó$Đ$rR   TŠÚstrictc               ó$   [        U [        5      (       a  SSKJn  U" U S9n U(       a  [	        U5      (       d1  OUR
                  R                  SS9(       d  SU< S3n[        U5      e[        U R                  U5      R                  5       5      $ )aÄ  
Expand selector to column names, with respect to a specific frame or target schema.

.. versionadded:: 0.20.30
    The `strict` parameter was added.

Parameters
----------
target
    A Polars DataFrame, LazyFrame or Schema.
selector
    An arbitrary polars selector (or compound selector).
strict
    Setting False additionally allows for a broader range of column selection
    expressions (such as bare columns or use of `.exclude()`) to be expanded,
    not just the dedicated selectors.

Examples
--------
>>> import polars.selectors as cs
>>> df = pl.DataFrame(
...     {
...         "colx": ["a", "b", "c"],
...         "coly": [123, 456, 789],
...         "colz": [2.0, 5.5, 8.0],
...     }
... )

Expand selector with respect to an existing `DataFrame`:

>>> cs.expand_selector(df, cs.numeric())
('coly', 'colz')
>>> cs.expand_selector(df, cs.first() | cs.last())
('colx', 'colz')

This also works with `LazyFrame`:

>>> cs.expand_selector(df.lazy(), ~(cs.first() | cs.last()))
('coly',)

Expand selector with respect to a standalone `Schema` dict:

>>> schema = {
...     "id": pl.Int64,
...     "desc": pl.String,
...     "count": pl.UInt32,
...     "value": pl.Float64,
... }
>>> cs.expand_selector(schema, cs.string() | cs.float())
('desc', 'value')

Allow for non-strict selection expressions (such as those
including use of an `.exclude()` constraint) to be expanded:

>>> cs.expand_selector(schema, cs.numeric().exclude("id"), strict=False)
('count', 'value')
r   )r"   )ÚschemaF)Úallow_aliasingzexpected a selector; found ú	 instead.)rU   r   Úpolars.dataframer"   r?   ÚmetaÚis_column_selectionÚ	TypeErrorÚtupleÚselectÚcollect_schema)ÚtargetÚselectorrW   r"   Úmsgs        rQ   r;   r;   w   s{    ô~ &'×"Ń"Ý.á &Ń)ö ô 	H×Ňŕ]]×.Ń.¸eĐ.ÖDŕ+¨HŠ<°yĐAÜnĐäxÓ(×7Ń7Ó9Ó:Đ:rR   c                ó°    [        U5      n/ nU HB  n[        U5      (       a  [        X5      nUR                  U5        M1  UR	                  U5        MD     U$ )a'  
Internal function that expands any selectors to column names in the given input.

Non-selector values are left as-is.

Examples
--------
>>> from polars.selectors import _expand_selectors
>>> import polars.selectors as cs
>>> df = pl.DataFrame(
...     {
...         "colw": ["a", "b"],
...         "colx": ["x", "y"],
...         "coly": [123, 456],
...         "colz": [2.0, 5.5],
...     }
... )
>>> _expand_selectors(df, ["colx", cs.numeric()])
['colx', 'coly', 'colz']
>>> _expand_selectors(df, cs.string(), cs.float())
['colw', 'colx', 'colz']
)r   r?   r;   ÚextendÚappend)ÚframeÚitemsÚ
items_iterÚexpandedÚitemÚselector_colss         rQ   Ú_expand_selectorsro   Č   sQ    ô. +¨5Ó1Jŕ#%HŰÜt×ŃÜ+¨EÓ8MŘOOMÖ*ŕOODÖ!ń đ OrR   F)Ú
tuple_keysc               óH   0 nU=(       d    0 R                  5        H  u  pgU(       a  [        U5      (       a  [        XS9XV'   XV   nU(       aL  [        U5      (       a<  [        XS9nU(       a  XuU'   MX  UR                  [        R                  X5      5        M~  XuU'   M     U$ )zCExpand dict key/value selectors into their underlying column names.)rd   )rj   r?   r;   ÚupdateÚdictÚfromkeys)	ÚdfÚdÚexpand_keysÚexpand_valuesrp   rl   ÚkeyÚvalueÚcolss	            rQ   Ú_expand_selector_dictsr|   ë   s    đ HŘwBooÖ'
Ţ[¨×/Ń/Ü+¨BŃ?HMŘMEŢ; s×+Ń+Ü" 2Ń4DŢŘ!&ŕ¤§Ą¨dÓ :Ö;ŕ!SMń (đ OrR   c                óŢ   / / / pCn/ n/ [        U [        5      (       a  [        U [        5      (       d  U OU /QUQ7 Hű  n[        U5      (       a  UR	                  U5        M&  [        U5      (       a  UR	                  U5        MI  [        U[        5      (       aR  UR                  S5      (       a)  UR                  S5      (       a  UR	                  U5        M  UR	                  U5        M°  [        U5      (       a+  UR	                  UR                  R                  5       5        Më  SU< S3n[        U5      e   / nU(       a  UR	                  [        USS065        U(       a  UR	                  [        U6 5        U(       aD  UR	                  [        [        U5      S:  a  SR!                  S	 U 5       5      OUS
   5      5        U(       a  UR#                  U5        [%        [&        U5      $ )zLCreate a combined selector from cols, names, dtypes, and/or other selectors.Ú^Ú$z:expected one or more `str`, `DataType` or selector; found r[   Úrequire_allFé   Ú|c              3  ó.   #    U  H  nS U S3v   M     g7f)Ú(Ú)NrN   )Ú.0Úrxs     rQ   Ú	<genexpr>Ú'_combine_as_selector.<locals>.<genexpr>0  s   é  Đ5ŞW r1RD ŞWůs   r   )rU   r   Ústrr?   rh   r   Ú
startswithÚendswithr   r]   Úoutput_namer_   r0   r.   rB   ÚlenÚjoinrg   r   r	   )	rj   Ú
more_itemsÚnamesÚregexesÚdtypesÚ	selectorsrm   re   Úselecteds	            rQ   Ú_combine_as_selectorr     s   đ    RFEŘ)+Iđô %¤×,Ń,´ZŔÄs×5KŃ5Kń ŕđ	đ 
ôô t×ŃŘ×ŃTÖ"ÜT×"Ń"ŘMM$ÖÜc×"Ń"Řs×#Ń#¨ŻŠ°c×(:Ń(:ŘtÖ$ŕTÖ"Üt__ŘLL×.Ń.Ó0Ö1ŕNČtÉhĐV_Đ`CÜC.Đ ń+đ. HŢŘ Đ:°EŃ:Ô;ŢŘ &Đ)Ô*ŢŘÜäw< !Ó#đ Ń5ŠWÓ5Ô5ŕQZóô	
ö Ř	Ô"ä#xÓ Đ rR   c                  óÂ   \ rS rSr% SrSrS\S'   \S#S j5       rS$S jr	S%S jr
S&S	 jrS'S
 jr\    S(S j5       r\S)S j5       rS*S jrS+S jrS+S jr\S,S j5       r\S+S j5       rS-S jrS+S jr\S,S j5       r\S+S j5       rS-S jrS+S jr\S,S j5       r\S+S j5       rS-S jrS.S jr\S,S j5       r\S+S j5       rS-S jrS+S jr      S/S  jrS0S! jrS"rg)1r'   i;  z&Base column selector expression/proxy.Nr   Ú_pyselectorc                óV    U " 5       nXl         [        R                  " U5      Ul        U$ rM   )r   r   Únew_selectorÚ_pyexpr)ÚclsÚ
pyselectorÚslfs      rQ   Ú_from_pyselectorÚSelector._from_pyselectorA  s%    áeŘ$Ü×)Ň)¨*Ó5Ř
rR   c                ó6    U R                   R                  5       $ rM   )r   Ú__getstate__ŠÚselfs    rQ   r˘   ÚSelector.__getstate__H  s    Ř||×(Ń(Ó*Đ*rR   c                óÖ    [         R                  " S5      R                  U l        U R                  R                  U5        U R                  R                  5       R                  U l        g )Nr   )ÚFÚlitr   Ú__setstate__r]   Úas_selectorr   )r¤   Ústates     rQ   rŠ   ÚSelector.__setstate__K  sD    ÜuuQx×'Ń'Ř×!Ń! %Ô(Ř99×0Ń0Ó2×>Ń>ŐrR   c                óT    [        [        R                  " U R                  5      5      $ rM   )r   r   Ú_from_pyexprr   rŁ   s    rQ   Ú__repr__ÚSelector.__repr__P  s    Ü4×$Ň$ T§\Ą\Ó2Ó3Đ3rR   c                ó6    U R                   R                  5       $ rM   )r   ÚhashrŁ   s    rQ   Ú__hash__ÚSelector.__hash__S  s    đ ×Ń×$Ń$Ó&Đ&rR   c                óH	   / n/ nU GH8  n[        U5      (       Gam  U[        R                  L a  U[        5       /-  nM8  [	        U[        R                  5      (       a*  UR
                  S:X  a  U[        UR                  SS9/-  nM  U[        R                  L a  U[        5       /-  nM¤  U[        R                  L a  U[        5       /-  nMÇ  U[        R                  L a  U[        5       /-  nMę  U[        R                  L a  U[        5       /-  nGM  U[        R                  L a  U[!        5       /-  nGM2  U[        R"                  L a  U[%        5       /-  nGMV  U[        R&                  L a  U[)        5       /-  nGMz  X4/-  nGM  [	        U[*        5      (       Ga3  U[,        L a  U[/        5       /-  nGM˛  U[0        R2                  L a  U[3        5       /-  nGMÖ  U[4        L a  U[7        5       /-  nGMđ  U[8        L a  U[        R:                  " 5       /-  nGM  U[<        L a  U[        R>                  " 5       /-  nGM:  U[@        L a  U[A        5       /-  nGMT  U[B        L a  U[        RD                  " 5       /-  nGMy  U[F        RH                  L a  U[        RJ                  " 5       /-  nGM¨  U[F        R                  L a  U[        5       /-  nGMĚ  U[F        RL                  L a  U[        5       /-  nGMđ  U[F        RN                  L a  U[O        5       /-  nGM  U[P        L a  U[)        5       /-  nGM.  U[0        R                  L d	  U[R        L a  U[        5       /-  nGM[  [+        [T        5      [*        L a  [T        OS[+        [T        5      RV                  < 3n[+        [T        5      [*        L a  SO
S[T        < S3nSU SU 3n[Y        U5      S e[+        [T        5      [*        L a  [T        OS[+        [T        5      RV                  < 3n[+        [T        5      [*        L a  SO
S[T        < S3nSU SU 3n[Y        U5      S e   U R[                  [\        R^                  " U5      5      n[a        U5      S	:X  a  U$ US	   n	US
S   H  n
X-  n	M	     [a        U5      S	:X  a  U	$ X-  $ )NÚ*)Ú	time_unitÚ	time_zonezof type Ú z	 (given: r   zcannot parse input z into Polars selectorr   r   )1r   ÚpldtÚDatetimer4   rU   r¸   rˇ   ÚDurationr7   r   r1   ÚEnumr9   ÚListrA   ÚArrayr+   ÚStructrH   r   r5   ÚtypeÚintr>   Úbuiltinsr=   Úboolr-   r   r   Úbytesr   Úobjectr    ÚNullÚ
pydatetimerJ   r   Ú	timedeltar3   Ú	PyDecimalr`   ÚinputÚ__name__r_   r   r   r.   r   )r   r   r   Úconcrete_dtypesÚdtÚ
input_typeÚinput_detailre   Údtype_selectorrd   Úss              rQ   Ú	_by_dtypeÚSelector._by_dtypeX  sÉ   đ 	ŘÜBÜr×"Ň"ŘŇ&Ř¤(Ł* Ń-IÜ ¤D§MĄM×2Ń2°rˇ|ą|ŔsÓ7JŘ¤(°Rˇ\ą\ČSŃ"QĐ!RŃRIŘ4==Ň(Ř¤(Ł* Ń-IŘ4×+Ń+Ň+Ř¤+Ł- Ń0IŘ499_Ř¤$Ł& Ń)IŘ499_Ř¤$Ł& Ń)IŘ4::Ň%Ř¤%Ł' Ń*IŘ4;;Ň&Ř¤&Ł( Ń+IŘ4<<Ň'Ř¤'Ł) Ń,Iŕ# tŃ+OÜB¤×%Ň%Ř9Ř¤'Ł) Ń,IŘ8>>Ň)Ř¤%Ł' Ń*IŘ4ZŘ¤'Ł) Ń,IŘ3YŘ#ŹŻŞŤ Ń6OŘ5[Ř#ŹŻŞŤ Ń6OŘ6\Ř¤&Ł( Ń+IŘ8^Ř#ŹŻ	Ş	Ť }Ń4OŘ:??Ň*Ř#ŹŻ	Ş	Ť }Ń4OŘ:×.Ń.Ň.Ř¤(Ł* Ń-IŘ:×/Ń/Ň/Ř¤(Ł* Ń-IŘ:??Ň*Ř¤$Ł& Ń)IŘ9_Ř¤'Ł) Ń,IŘ8==Ň(¨B´%ŞKŘ¤$Ł& Ń)Iô  ¤;Ź$Ň.ő ŕ'ŹŹUŤ×(<Ń(<Ń'?Đ@đ ô
 *.ŹeŤźŇ)<Ą2ŔIĚeÉYĐVWĐBXLŘ/°
¨|Đ;PĐQ]ĐP^Đ_CÜ# C.¨dĐ2ô E{¤dŇ*ő ŕ#¤DŹŁK×$8Ń$8Ń#;Đ<đ ô
 &*Ź%Ł[´DŇ%8rŔ	Ě%ÉĐRSĐ>TŘ+¨J¨<Đ7LČ\ČNĐ[Ü n¨$Đ.ńE đH ×-Ń-Źj×.AŇ.AŔ/Ó.RÓSäy>QÓŘ!Đ!ŕQ<Ř12AŘ|Hń äÓ 1Ó$ŘOŕ!Ń,Đ,rR   c               óL    U R                  [        R                  " X5      5      $ rM   )r   r   r0   )r   r   rW   s      rQ   Ú_by_nameÚSelector._by_nameŻ  s    ŕ×#Ń#¤J×$6Ň$6°uÓ$EÓFĐFrR   c                ó    [        5       U -
  $ )zInvert the selector.)r(   )r   s    rQ   Ú
__invert__ÚSelector.__invert__ł  s    äus{ĐrR   c                óş    [        U5      (       a-  U R                  5       R                  UR                  5       5      $ U R                  5       R                  U5      $ rM   )r?   Úas_exprÚ__add__Šr¤   Úothers     rQ   rÝ   ÚSelector.__add__ˇ  sA    Üu×ŃŘ<<>×)Ń)¨%Ż-Š-Ť/Ó:Đ:ŕ<<>×)Ń)¨%Ó0Đ0rR   c                óz    [        U5      (       a  Sn[        U5      eU R                  5       R                  U5      $ )Nz=unsupported operand type(s) for op: ('Selector' + 'Selector'))r?   r_   rÜ   Ú__radd__Šr¤   rß   re   s      rQ   râ   ÚSelector.__radd__˝  s3    Üu×ŃŘQCÜC.Đ ŕ<<>×*Ń*¨5Ó1Đ1rR   c                ó    g rM   rN   rŢ   s     rQ   Ú__and__ÚSelector.__and__Ä  ó    Ř47rR   c                ó    g rM   rN   rŢ   s     rQ   rć   rç   Ç  ó    Ř+.rR   c                óF   [        U5      (       a%  UR                  R                  5       n[        U5      n[	        U5      (       a>  [
        R                  [        R                  " U R                  UR                  5      5      $ U R                  5       R                  U5      $ rM   )r   r]   r   r0   r?   r'   r   r   Ú	intersectr   rÜ   rć   )r¤   rß   Úcolnames      rQ   rć   rç   Ę  s|    ÜU×ŃŘjj×,Ń,Ó.GÜGÓ$EÜu×ŃÜ×,Ń,Ü×$Ň$ T×%5Ń%5°u×7HŃ7HÓIóđ đ <<>×)Ń)¨%Ó0Đ0rR   c                ó@    U R                  5       R                  U5      $ rM   )rÜ   Ú__rand__rŢ   s     rQ   rď   ÚSelector.__rand__Ő  s    Ř||~×&Ń& uÓ-Đ-rR   c                ó    g rM   rN   rŢ   s     rQ   Ú__or__ÚSelector.__or__Ř  s    Ř36rR   c                ó    g rM   rN   rŢ   s     rQ   rň   ró   Ű  s    Ř*-rR   c                óB   [        U5      (       a#  [        UR                  R                  5       5      n[	        U5      (       a>  [
        R                  [        R                  " U R                  UR                  5      5      $ U R                  5       R                  U5      $ rM   )r   r0   r]   r   r?   r'   r   r   Úunionr   rÜ   rň   rŢ   s     rQ   rň   ró   Ţ  sw    ÜU×ŃÜEJJ×2Ń2Ó4Ó5EÜu×ŃÜ×,Ń,Ü× Ň  ×!1Ń!1°5×3DŃ3DÓEóđ đ <<>×(Ń(¨Ó/Đ/rR   c                óŚ    [        U5      (       a#  [        UR                  R                  5       5      nU R	                  5       R                  U5      $ rM   )r   r0   r]   r   rÜ   Ú__ror__rŢ   s     rQ   rř   ÚSelector.__ror__č  s;    ÜU×ŃÜEJJ×2Ń2Ó4Ó5EŘ||~×%Ń% eÓ,Đ,rR   c                ó    g rM   rN   rŢ   s     rQ   Ú__sub__ÚSelector.__sub__í  rč   rR   c                ó    g rM   rN   rŢ   s     rQ   rű   rü   đ  rę   rR   c                óÜ    [        U5      (       a>  [        R                  [        R                  " U R
                  UR
                  5      5      $ U R                  5       R                  U5      $ rM   )r?   r'   r   r   Ú
differencer   rÜ   rű   rŢ   s     rQ   rű   rü   ó  sU    Üu×ŃÜ×,Ń,Ü×%Ň% d×&6Ń&6¸×8IŃ8IÓJóđ đ <<>×)Ń)¨%Ó0Đ0rR   c                ó    Sn[        U5      e)Nz9unsupported operand type(s) for op: ('Expr' - 'Selector'))r_   ră   s      rQ   Ú__rsub__ÚSelector.__rsub__ű  s    ŘIÜnĐrR   c                ó    g rM   rN   rŢ   s     rQ   Ú__xor__ÚSelector.__xor__˙  rč   rR   c                ó    g rM   rN   rŢ   s     rQ   r  r    rę   rR   c                óB   [        U5      (       a#  [        UR                  R                  5       5      n[	        U5      (       a>  [
        R                  [        R                  " U R                  UR                  5      5      $ U R                  5       R                  U5      $ rM   )r   r0   r]   r   r?   r'   r   r   Úexclusive_orr   rÜ   r  rŢ   s     rQ   r  r    sw    ÜU×ŃÜEJJ×2Ń2Ó4Ó5EÜu×ŃÜ×,Ń,Ü×'Ň'¨×(8Ń(8¸%×:KŃ:KÓLóđ đ <<>×)Ń)¨%Ó0Đ0rR   c                óŚ    [        U5      (       a#  [        UR                  R                  5       5      nU R	                  5       R                  U5      $ rM   )r   r0   r]   r   rÜ   Ú__rxor__rŢ   s     rQ   r
  ÚSelector.__rxor__  s;    ÜU×ŃÜEJJ×2Ń2Ó4Ó5EŘ||~×&Ń& uÓ-Đ-rR   c                ó°   / n/ n/ [        U[        5      (       a  [        U[        5      (       d  UOU/QUQ7 H^  n[        U[        5      (       a  UR                  U5        M+  [	        U5      (       a  UR                  U5        MN  SU< S3n[        U5      e   U(       a  U(       a  Sn[        U5      eU(       a  U [        U5      -
  $ U [        USS9-
  $ )aö  
Exclude columns from a multi-column expression.

Only works after a wildcard or regex column selection, and you cannot provide
both string column names *and* dtypes (you may prefer to use selectors instead).

Parameters
----------
columns
    The name or datatype of the column(s) to exclude. Accepts regular expression
    input. Regular expressions should start with `^` and end with `$`.
*more_columns
    Additional names or datatypes of columns to exclude, specified as positional
    arguments.
zMinvalid input for `exclude`

Expected one or more `str` or `DataType`; found r[   zDcannot exclude by both column name and dtype; use a selector insteadFŠr   )rU   r   r   rh   r   r_   r.   r0   )r¤   ÚcolumnsÚmore_columnsÚexclude_colsÚexclude_dtypesrm   re   s          rQ   r:   ÚSelector.exclude  sä    đ( ,.Ř8:đ
ô g¤z×2Ń2ź:ŔgĚs×;SŃ;Sń ŕYđ	
đ ô
Dô $¤×$Ń$Ř×#Ń# DÖ)Ü  ×&Ń&Ř×%Ń% dÖ+đKŘKOÉ(ĐR[đ]đ ô   nĐ$ń#
ö& NŘXCÜC.Đ ŢŘ( >Ó2Ń2Đ2ŕ' ,¸EŃBŃBĐBrR   c                óB    [         R                  " U R                  5      $ )uS  
Materialize the `selector` as a normal expression.

This ensures that the operators `|`, `&`, `~` and `-`
are applied on the data and not on the selector sets.

Examples
--------
>>> import polars.selectors as cs
>>> df = pl.DataFrame(
...     {
...         "colx": ["aa", "bb", "cc"],
...         "coly": [True, False, True],
...         "colz": [1, 2, 3],
...     }
... )

Inverting the boolean selector will choose the non-boolean columns:

>>> df.select(~cs.boolean())
shape: (3, 2)
ââââââââŹâââââââ
â colx â colz â
â ---  â ---  â
â str  â i64  â
ââââââââŞâââââââĄ
â aa   â 1    â
â bb   â 2    â
â cc   â 3    â
ââââââââ´âââââââ

To invert the *values* in the selected boolean columns, we need to
materialize the selector as a standard expression instead:

>>> df.select(~cs.boolean().as_expr())
shape: (3, 1)
âââââââââ
â coly  â
â ---   â
â bool  â
âââââââââĄ
â false â
â true  â
â false â
âââââââââ
)r   rŽ   r   rŁ   s    rQ   rÜ   ÚSelector.as_exprE  s    ô^ × Ň  §ĄÓ.Đ.rR   )r   r   )r   r   Úreturnr'   )r  rĹ   )rŤ   rĹ   r  ÚNone)r  r   )r  rÂ   )r   z.builtins.list[PythonDataType | PolarsDataType]r  r'   )r   zbuiltins.list[str]rW   rÄ   r  r'   Šr  r'   )rß   r   r  r   )rß   r'   r  r'   )rß   r   r  úSelector | Expr)rß   r   r  r   )r  zCstr | PolarsDataType | Collection[str] | Collection[PolarsDataType]r  zstr | PolarsDataTyper  r'   )r  r   )rĚ   Ú
__module__Ú__qualname__Ú__firstlineno__Ú__doc__r   Ú__annotations__Úclassmethodr   r˘   rŠ   rŻ   rł   rÓ   rÖ   rŮ   rÝ   râ   r   rć   rď   rň   rř   rű   r  r  r
  r:   rÜ   Ú__static_attributes__rN   rR   rQ   r'   r'   ;  sP   Ů0đ #KÓ"ŕóó đô+ô?ô
4ô'đ
 đT-ŘCđT-ŕ	óT-ó đT-đl óGó đGôô1ô2đ Ű7ó Ř7ŕŰ.ó Ř.ô	1ô.đ Ű6ó Ř6ŕŰ-ó Ř-ô0ô-đ
 Ű7ó Ř7ŕŰ.ó Ř.ô1ôđ Ű7ó Ř7ŕŰ.ó Ř.ô1ô.đ
/CŕTđ/Cđ ,đ/Cđ 
ô	/C÷b//rR   )Úescapec               óL  ^ [        U [        5      (       a  T(       a  [        U 5      OU nOt/ nU  HQ  n[        U[        5      (       a(  [        U[        5      (       d  UR	                  U5        M@  UR                  U5        MS     SR                  U4S jU 5       5      nSU S3$ )zIReturn escaped regex, potentially representing multiple string fragments.r   c              3  óL   >#    U  H  nT(       a  [        U5      OUv   M     g 7frM   )r   )r   Úxr   s     rQ   r   Ú_re_string.<locals>.<genexpr>  s   řé  ĐGşw¸!Śvy |°1Ô4şwůs   !$r   r   )rU   r   r   r   rg   rh   r   )rG   r   r   ÚstringsÚsts    `   rQ   Ú
_re_stringr'  w  s   ř ä&#×ŃŢ"(YvÔ¨fŕ&(ŰBÜ"j×)Ń)´*¸RÄ×2EŃ2EŘrÖ"ŕrÖ"ń	 đ
 XXÔGšwÓGÓGŘrd!9ĐrR   c                 óR    [         R                  [        R                  " 5       5      $ )u  
Select no columns.

This is useful for composition with other selectors.

See Also
--------
all : Select all columns in the current scope.

Examples
--------
>>> import polars.selectors as cs
>>> pl.DataFrame({"a": 1, "b": 2}).select(cs.empty())
shape: (0, 0)
ââ
ââĄ
ââ
)r'   r   r   ÚemptyrN   rR   rQ   r)  r)    s    ô& ×$Ń$¤Z×%5Ň%5Ó%7Ó8Đ8rR   c                 óR    [         R                  [        R                  " 5       5      $ )uŢ  
Select all columns.

See Also
--------
first : Select the first column in the current scope.
last : Select the last column in the current scope.

Examples
--------
>>> from datetime import date
>>> import polars.selectors as cs
>>> df = pl.DataFrame(
...     {
...         "dt": [date(1999, 12, 31), date(2024, 1, 1)],
...         "value": [1_234_500, 5_000_555],
...     },
...     schema_overrides={"value": pl.Int32},
... )

Select all columns, casting them to string:

>>> df.select(cs.all().cast(pl.String))
shape: (2, 2)
ââââââââââââââŹââââââââââ
â dt         â value   â
â ---        â ---     â
â str        â str     â
ââââââââââââââŞââââââââââĄ
â 1999-12-31 â 1234500 â
â 2024-01-01 â 5000555 â
ââââââââââââââ´ââââââââââ

Select all columns *except* for those matching the given dtypes:

>>> df.select(cs.all() - cs.numeric())
shape: (2, 1)
ââââââââââââââ
â dt         â
â ---        â
â date       â
ââââââââââââââĄ
â 1999-12-31 â
â 2024-01-01 â
ââââââââââââââ
)r'   r   r   r(   rN   rR   rQ   r(   r(     s    ô^ ×$Ń$¤Z§^˘^Ó%5Ó6Đ6rR   )Úignore_spacesc               ó    U (       a  SOSnU(       a  SOSn[         R                  [        R                  " SU U S35      5      $ )u÷
  
Select all columns with alphabetic names (eg: only letters).

Parameters
----------
ascii_only
    Indicate whether to consider only ASCII alphabetic characters, or the full
    Unicode range of valid letters (accented, idiographic, etc).
ignore_spaces
    Indicate whether to ignore the presence of spaces in column names; if so,
    only the other (non-space) characters are considered.

Notes
-----
Matching column names cannot contain *any* non-alphabetic characters. Note
that the definition of "alphabetic" consists of all valid Unicode alphabetic
characters (`\p{Alphabetic}`) by default; this can be changed by setting
`ascii_only=True`.

Examples
--------
>>> import polars as pl
>>> import polars.selectors as cs
>>> df = pl.DataFrame(
...     {
...         "no1": [100, 200, 300],
...         "cafĂŠ": ["espresso", "latte", "mocha"],
...         "t or f": [True, False, None],
...         "hmm": ["aaa", "bbb", "ccc"],
...         "é˝ĺ¸": ["ćąäşŹ", "ĺ¤§éŞ", "äşŹé˝"],
...     }
... )

Select columns with alphabetic names; note that accented
characters and kanji are recognised as alphabetic here:

>>> df.select(cs.alpha())
shape: (3, 3)
ââââââââââââŹââââââŹâââââââ
â cafĂŠ     â hmm â é˝ĺ¸ â
â ---      â --- â ---  â
â str      â str â str  â
ââââââââââââŞââââââŞâââââââĄ
â espresso â aaa â ćąäşŹ â
â latte    â bbb â ĺ¤§éŞ â
â mocha    â ccc â äşŹé˝ â
ââââââââââââ´ââââââ´âââââââ

Constrain the definition of "alphabetic" to ASCII characters only:

>>> df.select(cs.alpha(ascii_only=True))
shape: (3, 1)
âââââââ
â hmm â
â --- â
â str â
âââââââĄ
â aaa â
â bbb â
â ccc â
âââââââ

>>> df.select(cs.alpha(ascii_only=True, ignore_spaces=True))
shape: (3, 2)
ââââââââââŹââââââ
â t or f â hmm â
â ---    â --- â
â bool   â str â
ââââââââââŞââââââĄ
â true   â aaa â
â false  â bbb â
â null   â ccc â
ââââââââââ´ââââââ

Select all columns *except* for those with alphabetic names:

>>> df.select(~cs.alpha())
shape: (3, 2)
âââââââŹâââââââââ
â no1 â t or f â
â --- â ---    â
â i64 â bool   â
âââââââŞâââââââââĄ
â 100 â true   â
â 200 â false  â
â 300 â null   â
âââââââ´âââââââââ

>>> df.select(~cs.alpha(ignore_spaces=True))
shape: (3, 1)
âââââââ
â no1 â
â --- â
â i64 â
âââââââĄ
â 100 â
â 200 â
â 300 â
âââââââ
úa-zA-Zú\p{Alphabetic}Ú rš   ú^[ú]+$Šr'   r   r   rB   )Ú
ascii_onlyr+  Úre_alphaÚre_spaces       rQ   r)   r)   Î  sB    öL 'yĐ,=HŢ#s¨HÜ×$Ń$¤Z×%7Ň%7¸"¸X¸JŔxŔjĐPSĐ8TÓ%UÓVĐVrR   c          	     óŚ    U (       a  SOSnU (       a  SOSnU(       a  SOSn[         R                  [        R                  " SU U U S35      5      $ )	u  
Select all columns with alphanumeric names (eg: only letters and the digits 0-9).

Parameters
----------
ascii_only
    Indicate whether to consider only ASCII alphabetic characters, or the full
    Unicode range of valid letters (accented, idiographic, etc).
ignore_spaces
    Indicate whether to ignore the presence of spaces in column names; if so,
    only the other (non-space) characters are considered.

Notes
-----
Matching column names cannot contain *any* non-alphabetic or integer characters.
Note that the definition of "alphabetic" consists of all valid Unicode alphabetic
characters (`\p{Alphabetic}`) and digit characters (`\d`) by default; this
can be changed by setting `ascii_only=True`.

Examples
--------
>>> import polars as pl
>>> import polars.selectors as cs
>>> df = pl.DataFrame(
...     {
...         "1st_col": [100, 200, 300],
...         "flagged": [True, False, True],
...         "00prefix": ["01:aa", "02:bb", "03:cc"],
...         "last col": ["x", "y", "z"],
...     }
... )

Select columns with alphanumeric names:

>>> df.select(cs.alphanumeric())
shape: (3, 2)
âââââââââââŹâââââââââââ
â flagged â 00prefix â
â ---     â ---      â
â bool    â str      â
âââââââââââŞâââââââââââĄ
â true    â 01:aa    â
â false   â 02:bb    â
â true    â 03:cc    â
âââââââââââ´âââââââââââ

>>> df.select(cs.alphanumeric(ignore_spaces=True))
shape: (3, 3)
âââââââââââŹâââââââââââŹâââââââââââ
â flagged â 00prefix â last col â
â ---     â ---      â ---      â
â bool    â str      â str      â
âââââââââââŞâââââââââââŞâââââââââââĄ
â true    â 01:aa    â x        â
â false   â 02:bb    â y        â
â true    â 03:cc    â z        â
âââââââââââ´âââââââââââ´âââââââââââ

Select all columns *except* for those with alphanumeric names:

>>> df.select(~cs.alphanumeric())
shape: (3, 2)
âââââââââââŹâââââââââââ
â 1st_col â last col â
â ---     â ---      â
â i64     â str      â
âââââââââââŞâââââââââââĄ
â 100     â x        â
â 200     â y        â
â 300     â z        â
âââââââââââ´âââââââââââ

>>> df.select(~cs.alphanumeric(ignore_spaces=True))
shape: (3, 1)
âââââââââââ
â 1st_col â
â ---     â
â i64     â
âââââââââââĄ
â 100     â
â 200     â
â 300     â
âââââââââââ
r-  r.  z0-9ú\dr/  rš   r0  r1  r2  )r3  r+  r4  Úre_digitr5  s        rQ   r*   r*   9  sS    öt 'yĐ,=HŢ"u¨HŢ#s¨HÜ×$Ń$Ü×ŇR z¨(¨°H°:¸SĐAÓBóđ rR   c                 ó"    [        [        /5      $ )uR  
Select all binary columns.

See Also
--------
by_dtype : Select all columns matching the given dtype(s).
string : Select all string columns (optionally including categoricals).

Examples
--------
>>> import polars.selectors as cs
>>> df = pl.DataFrame({"a": [b"hello"], "b": ["world"], "c": [b"!"], "d": [":)"]})
>>> df
shape: (1, 4)
ââââââââââââŹââââââââŹâââââââââŹââââââ
â a        â b     â c      â d   â
â ---      â ---   â ---    â --- â
â binary   â str   â binary â str â
ââââââââââââŞââââââââŞâââââââââŞââââââĄ
â b"hello" â world â b"!"   â :)  â
ââââââââââââ´ââââââââ´âââââââââ´ââââââ

Select binary columns and export as a dict:

>>> df.select(cs.binary()).to_dict(as_series=False)
{'a': [b'hello'], 'c': [b'!']}

Select all columns *except* for those that are binary:

>>> df.select(~cs.binary()).to_dict(as_series=False)
{'b': ['world'], 'd': [':)']}
)r.   r   rN   rR   rQ   r,   r,     s    ôB VHÓĐrR   c                 ó"    [        [        /5      $ )um  
Select all boolean columns.

See Also
--------
by_dtype : Select all columns matching the given dtype(s).

Examples
--------
>>> import polars.selectors as cs
>>> df = pl.DataFrame({"n": range(1, 5)}).with_columns(n_even=pl.col("n") % 2 == 0)
>>> df
shape: (4, 2)
âââââââŹâââââââââ
â n   â n_even â
â --- â ---    â
â i64 â bool   â
âââââââŞâââââââââĄ
â 1   â false  â
â 2   â true   â
â 3   â false  â
â 4   â true   â
âââââââ´âââââââââ

Select and invert boolean columns:

>>> df.with_columns(is_odd=cs.boolean().not_())
shape: (4, 3)
âââââââŹâââââââââŹâââââââââ
â n   â n_even â is_odd â
â --- â ---    â ---    â
â i64 â bool   â bool   â
âââââââŞâââââââââŞâââââââââĄ
â 1   â false  â true   â
â 2   â true   â false  â
â 3   â false  â true   â
â 4   â true   â false  â
âââââââ´âââââââââ´âââââââââ

Select all columns *except* for those that are boolean:

>>> df.select(~cs.boolean())
shape: (4, 1)
âââââââ
â n   â
â --- â
â i64 â
âââââââĄ
â 1   â
â 2   â
â 3   â
â 4   â
âââââââ
)r.   r   rN   rR   rQ   r-   r-   ż  s    ôn WIÓĐrR   c                 ó   / nU  Hą  n[        U5      (       d  [        U[        5      (       a  UR                  U5        M;  [        U[        5      (       aR  U HJ  n[        U5      (       d&  [        U[        5      (       d  SU< 3n[        U5      eUR                  U5        ML     M˘  SU< 3n[        U5      e   [        R                  U5      $ )uä  
Select all columns matching the given dtypes.

See Also
--------
by_name : Select all columns matching the given names.
by_index : Select all columns matching the given indices.

Examples
--------
>>> from datetime import date
>>> import polars.selectors as cs
>>> df = pl.DataFrame(
...     {
...         "dt": [date(1999, 12, 31), date(2024, 1, 1), date(2010, 7, 5)],
...         "value": [1_234_500, 5_000_555, -4_500_000],
...         "other": ["foo", "bar", "foo"],
...     }
... )

Select all columns with date or string dtypes:

>>> df.select(cs.by_dtype(pl.Date, pl.String))
shape: (3, 2)
ââââââââââââââŹââââââââ
â dt         â other â
â ---        â ---   â
â date       â str   â
ââââââââââââââŞââââââââĄ
â 1999-12-31 â foo   â
â 2024-01-01 â bar   â
â 2010-07-05 â foo   â
ââââââââââââââ´ââââââââ

Select all columns that are not of date or string dtype:

>>> df.select(~cs.by_dtype(pl.Date, pl.String))
shape: (3, 1)
ââââââââââââ
â value    â
â ---      â
â i64      â
ââââââââââââĄ
â 1234500  â
â 5000555  â
â -4500000 â
ââââââââââââ

Group by string columns and sum the numeric columns:

>>> df.group_by(cs.string()).agg(cs.numeric().sum()).sort(by="other")
shape: (2, 2)
âââââââââŹâââââââââââ
â other â value    â
â ---   â ---      â
â str   â i64      â
âââââââââŞâââââââââââĄ
â bar   â 5000555  â
â foo   â -3265500 â
âââââââââ´âââââââââââ
zinvalid dtype: )r   rU   rÁ   rh   r   r_   r'   rÓ   )r   Ú
all_dtypesÚtpÚtre   s        rQ   r.   r.   ů  s¸    đJ BDJŰÜ2×Ń¤*¨R´×"6Ń"6Ř×ŃbÖ!ÜJ×'Ń'ŰÜ'¨×*Ń*Źj¸źD×.AŃ.AŘ+¨AŠ5Đ1CÜ# C.Đ(Ř×!Ń! !Ö$ó	 đ $ BĄ6Đ*CÜC.Đ ń ô ×ŃjÓ)Đ)rR   r  c                ó4   / nU Hh  n[        U[        [        45      (       a  UR                  U5        M1  [        U[        5      (       a  UR                  U5        MY  SU< 3n[        U5      e   [        R                  [        R                  " X 5      5      $ )up  
Select all columns matching the given indices (or range objects).

Parameters
----------
*indices
    One or more column indices (or range objects).
    Negative indexing is supported.

Notes
-----
Matching columns are returned in the order in which their indexes
appear in the selector, not the underlying schema order.

See Also
--------
by_dtype : Select all columns matching the given dtypes.
by_name : Select all columns matching the given names.

Examples
--------
>>> import polars.selectors as cs
>>> df = pl.DataFrame(
...     {
...         "key": ["abc"],
...         **{f"c{i:02}": [0.5 * i] for i in range(100)},
...     },
... )
>>> print(df)
shape: (1, 101)
âââââââŹââââââŹââââââŹââââââŹââââŹâââââââŹâââââââŹâââââââŹâââââââ
â key â c00 â c01 â c02 â âŚ â c96  â c97  â c98  â c99  â
â --- â --- â --- â --- â   â ---  â ---  â ---  â ---  â
â str â f64 â f64 â f64 â   â f64  â f64  â f64  â f64  â
âââââââŞââââââŞââââââŞââââââŞââââŞâââââââŞâââââââŞâââââââŞâââââââĄ
â abc â 0.0 â 0.5 â 1.0 â âŚ â 48.0 â 48.5 â 49.0 â 49.5 â
âââââââ´ââââââ´ââââââ´ââââââ´ââââ´âââââââ´âââââââ´âââââââ´âââââââ

Select columns by index ("key" column and the two first/last columns):

>>> df.select(cs.by_index(0, 1, 2, -2, -1))
shape: (1, 5)
âââââââŹââââââŹââââââŹâââââââŹâââââââ
â key â c00 â c01 â c98  â c99  â
â --- â --- â --- â ---  â ---  â
â str â f64 â f64 â f64  â f64  â
âââââââŞââââââŞââââââŞâââââââŞâââââââĄ
â abc â 0.0 â 0.5 â 49.0 â 49.5 â
âââââââ´ââââââ´ââââââ´âââââââ´âââââââ

Select the "key" column and use a `range` object to select various columns.
Note that you can freely mix and match integer indices and `range` objects:

>>> df.select(cs.by_index(0, range(1, 101, 20)))
shape: (1, 6)
âââââââŹââââââŹâââââââŹâââââââŹâââââââŹâââââââ
â key â c00 â c20  â c40  â c60  â c80  â
â --- â --- â ---  â ---  â ---  â ---  â
â str â f64 â f64  â f64  â f64  â f64  â
âââââââŞââââââŞâââââââŞâââââââŞâââââââŞâââââââĄ
â abc â 0.0 â 10.0 â 20.0 â 30.0 â 40.0 â
âââââââ´ââââââ´âââââââ´âââââââ´âââââââ´âââââââ

>>> df.select(cs.by_index(0, range(101, 0, -25), require_all=False))
shape: (1, 5)
âââââââŹâââââââŹâââââââŹâââââââŹââââââ
â key â c75  â c50  â c25  â c00 â
â --- â ---  â ---  â ---  â --- â
â str â f64  â f64  â f64  â f64 â
âââââââŞâââââââŞâââââââŞâââââââŞââââââĄ
â abc â 37.5 â 25.0 â 12.5 â 0.0 â
âââââââ´âââââââ´âââââââ´âââââââ´ââââââ

Select all columns *except* for the even-indexed ones:

>>> df.select(~cs.by_index(range(1, 100, 2)))
shape: (1, 51)
âââââââŹââââââŹââââââŹââââââŹââââŹâââââââŹâââââââŹâââââââŹâââââââ
â key â c01 â c03 â c05 â âŚ â c93  â c95  â c97  â c99  â
â --- â --- â --- â --- â   â ---  â ---  â ---  â ---  â
â str â f64 â f64 â f64 â   â f64  â f64  â f64  â f64  â
âââââââŞââââââŞââââââŞââââââŞââââŞâââââââŞâââââââŞâââââââŞâââââââĄ
â abc â 0.5 â 1.5 â 2.5 â âŚ â 46.5 â 47.5 â 48.5 â 49.5 â
âââââââ´ââââââ´ââââââ´ââââââ´ââââ´âââââââ´âââââââ´âââââââ´âââââââ
zinvalid index value: )rU   Úranger   rg   rÂ   rh   r_   r'   r   r   r/   )r   ÚindicesÚall_indicesÚidxre   s        rQ   r/   r/   O  s    đp ')KŰÜcE¤8Đ,×-Ń-Ř×ŃsÖ#ÜS×!Ń!Ř×ŃsÖ#ŕ)¨#ŠĐ1CÜC.Đ ń ô ×$Ń$¤Z×%8Ň%8¸Ó%RÓSĐSrR   c                óZ   / nU H  n[        U[        5      (       a  UR                  U5        M+  [        U[        5      (       aB  U H:  n[        U[        5      (       d  SU< 3n[	        U5      eUR                  U5        M<     M  SU< 3n[	        U5      e   [
        R                  X S9$ )ué  
Select all columns matching the given names.

.. versionadded:: 0.20.27
  The `require_all` parameter was added.

Parameters
----------
*names
    One or more names of columns to select.
require_all
    Whether to match *all* names (the default) or *any* of the names.

Notes
-----
Matching columns are returned in the order in which they are declared in
the selector, not the underlying schema order.

See Also
--------
by_dtype : Select all columns matching the given dtypes.
by_index : Select all columns matching the given indices.

Examples
--------
>>> import polars.selectors as cs
>>> df = pl.DataFrame(
...     {
...         "foo": ["x", "y"],
...         "bar": [123, 456],
...         "baz": [2.0, 5.5],
...         "zap": [False, True],
...     }
... )

Select columns by name:

>>> df.select(cs.by_name("foo", "bar"))
shape: (2, 2)
âââââââŹââââââ
â foo â bar â
â --- â --- â
â str â i64 â
âââââââŞââââââĄ
â x   â 123 â
â y   â 456 â
âââââââ´ââââââ

Match *any* of the given columns by name:

>>> df.select(cs.by_name("baz", "moose", "foo", "bear", require_all=False))
shape: (2, 2)
âââââââŹââââââ
â baz â foo â
â --- â --- â
â f64 â str â
âââââââŞââââââĄ
â 2.0 â x   â
â 5.5 â y   â
âââââââ´ââââââ

Match all columns *except* for those given:

>>> df.select(~cs.by_name("foo", "bar"))
shape: (2, 2)
âââââââŹââââââââ
â baz â zap   â
â --- â ---   â
â f64 â bool  â
âââââââŞââââââââĄ
â 2.0 â false â
â 5.5 â true  â
âââââââ´ââââââââ
zinvalid name: rV   )rU   r   rh   r   r_   r'   rÖ   )r   r   Ú	all_namesÚnmÚnre   s         rQ   r0   r0   ´  sĽ    đV IŰÜb#×ŃŘ×ŃRÖ ÜJ×'Ń'ŰÜ! !¤S×)Ń)Ř*¨1Š%Đ0CÜ# C.Đ(Ř× Ń  Ö#ó	 đ # 2Ą&Đ)CÜC.Đ ń ô ×ŃYĐĐ;Đ;rR   c                 óR    [         R                  [        R                  " 5       5      $ )uy  
Select all enum columns.

.. warning::
    This functionality is considered **unstable**. It may be changed
    at any point without it being considered a breaking change.

See Also
--------
by_dtype : Select all columns matching the given dtype(s).
categorical : Select all categorical columns.
string : Select all string columns (optionally including categoricals).

Examples
--------
>>> import polars.selectors as cs
>>> df = pl.DataFrame(
...     {
...         "foo": ["xx", "yy"],
...         "bar": [123, 456],
...         "baz": [2.0, 5.5],
...     },
...     schema_overrides={"foo": pl.Enum(["xx", "yy"])},
... )

Select all enum columns:

>>> df.select(cs.enum())
shape: (2, 1)
ââââââââ
â foo  â
â ---  â
â enum â
ââââââââĄ
â xx   â
â yy   â
ââââââââ

Select all columns *except* for those that are enum:

>>> df.select(~cs.enum())
shape: (2, 2)
âââââââŹââââââ
â bar â baz â
â --- â --- â
â i64 â f64 â
âââââââŞââââââĄ
â 123 â 2.0 â
â 456 â 5.5 â
âââââââ´ââââââ
)r'   r   r   Úenum_rN   rR   rQ   r9   r9     s    ôj ×$Ń$¤Z×%5Ň%5Ó%7Ó8Đ8rR   c                óv    U b  U R                   OSn[        R                  [        R                  " U5      5      $ )u=  
Select all list columns.

.. warning::
    This functionality is considered **unstable**. It may be changed
    at any point without it being considered a breaking change.

See Also
--------
by_dtype : Select all columns matching the given dtype(s).
array : Select all array columns.
nested : Select all nested columns.

Examples
--------
>>> import polars.selectors as cs
>>> df = pl.DataFrame(
...     {
...         "foo": [["xx", "yy"], ["x"]],
...         "bar": [123, 456],
...         "baz": [2.0, 5.5],
...     },
... )

Select all list columns:

>>> df.select(cs.list())
shape: (2, 1)
ââââââââââââââââ
â foo          â
â ---          â
â list[str]    â
ââââââââââââââââĄ
â ["xx", "yy"] â
â ["x"]        â
ââââââââââââââââ

Select all columns *except* for those that are list:

>>> df.select(~cs.list())
shape: (2, 2)
âââââââŹââââââ
â bar â baz â
â --- â --- â
â i64 â f64 â
âââââââŞââââââĄ
â 123 â 2.0 â
â 456 â 5.5 â
âââââââ´ââââââ

Select all list columns with a certain matching inner type:

>>> df.select(cs.list(cs.string()))
shape: (2, 1)
ââââââââââââââââ
â foo          â
â ---          â
â list[str]    â
ââââââââââââââââĄ
â ["xx", "yy"] â
â ["x"]        â
ââââââââââââââââ
>>> df.select(cs.list(cs.integer()))
shape: (0, 0)
ââ
ââĄ
ââ
N)r   r'   r   r   rA   )ÚinnerÚinner_ss     rQ   rA   rA   H  s1    đL $)Ń#4e×Ň¸$GÜ×$Ń$¤Z§_˘_°WÓ%=Ó>Đ>rR   )Úwidthc               óv    U b  U R                   OSn[        R                  [        R                  " X!5      5      $ )u  
Select all array columns.

.. warning::
    This functionality is considered **unstable**. It may be changed
    at any point without it being considered a breaking change.

See Also
--------
by_dtype : Select all columns matching the given dtype(s).
list : Select all list columns.
nested : Select all nested columns.

Examples
--------
>>> import polars.selectors as cs
>>> df = pl.DataFrame(
...     {
...         "foo": [["xx", "yy"], ["x", "y"]],
...         "bar": [123, 456],
...         "baz": [2.0, 5.5],
...     },
...     schema_overrides={"foo": pl.Array(pl.String, 2)},
... )

Select all array columns:

>>> df.select(cs.array())
shape: (2, 1)
âââââââââââââââââ
â foo           â
â ---           â
â array[str, 2] â
âââââââââââââââââĄ
â ["xx", "yy"]  â
â ["x", "y"]    â
âââââââââââââââââ

Select all columns *except* for those that are array:

>>> df.select(~cs.array())
shape: (2, 2)
âââââââŹââââââ
â bar â baz â
â --- â --- â
â i64 â f64 â
âââââââŞââââââĄ
â 123 â 2.0 â
â 456 â 5.5 â
âââââââ´ââââââ

Select all array columns with a certain matching inner type:

>>> df.select(cs.array(cs.string()))
shape: (2, 1)
âââââââââââââââââ
â foo           â
â ---           â
â array[str, 2] â
âââââââââââââââââĄ
â ["xx", "yy"]  â
â ["x", "y"]    â
âââââââââââââââââ
>>> df.select(cs.array(cs.integer()))
shape: (0, 0)
ââ
ââĄ
ââ
>>> df.select(cs.array(width=2))
shape: (2, 1)
âââââââââââââââââ
â foo           â
â ---           â
â array[str, 2] â
âââââââââââââââââĄ
â ["xx", "yy"]  â
â ["x", "y"]    â
âââââââââââââââââ
>>> df.select(cs.array(width=3))
shape: (0, 0)
ââ
ââĄ
ââ
N)r   r'   r   r   r+   )rK  rM  rL  s      rQ   r+   r+     s3    đl $)Ń#4e×Ň¸$GÜ×$Ń$¤Z×%5Ň%5°gÓ%EÓFĐFrR   c                 óR    [         R                  [        R                  " 5       5      $ )uŻ  
Select all struct columns.

.. warning::
    This functionality is considered **unstable**. It may be changed
    at any point without it being considered a breaking change.

See Also
--------
by_dtype : Select all columns matching the given dtype(s).
list : Select all list columns.
array : Select all array columns.
nested : Select all nested columns.

Examples
--------
>>> import polars.selectors as cs
>>> df = pl.DataFrame(
...     {
...         "foo": [{"a": "xx", "b": "z"}, {"a": "x", "b": "y"}],
...         "bar": [123, 456],
...         "baz": [2.0, 5.5],
...     },
... )

Select all struct columns:

>>> df.select(cs.struct())
shape: (2, 1)
ââââââââââââââ
â foo        â
â ---        â
â struct[2]  â
ââââââââââââââĄ
â {"xx","z"} â
â {"x","y"}  â
ââââââââââââââ

Select all columns *except* for those that are struct:

>>> df.select(~cs.struct())
shape: (2, 2)
âââââââŹââââââ
â bar â baz â
â --- â --- â
â i64 â f64 â
âââââââŞââââââĄ
â 123 â 2.0 â
â 456 â 5.5 â
âââââââ´ââââââ
)r'   r   r   Ústruct_rN   rR   rQ   rH   rH   ě  s    ôj ×$Ń$¤Z×%7Ň%7Ó%9Ó:Đ:rR   c                 óR    [         R                  [        R                  " 5       5      $ )u°  
Select all nested columns.

A nested column is a list, array or struct.

.. warning::
    This functionality is considered **unstable**. It may be changed
    at any point without it being considered a breaking change.

See Also
--------
by_dtype : Select all columns matching the given dtype(s).
list : Select all list columns.
array : Select all array columns.
struct : Select all struct columns.

Examples
--------
>>> import polars.selectors as cs
>>> df = pl.DataFrame(
...     {
...         "foo": [{"a": "xx", "b": "z"}, {"a": "x", "b": "y"}],
...         "bar": [123, 456],
...         "baz": [2.0, 5.5],
...         "wow": [[1, 2], [3]],
...     },
... )

Select all nested columns:

>>> df.select(cs.nested())
shape: (2, 2)
ââââââââââââââŹââââââââââââ
â foo        â wow       â
â ---        â ---       â
â struct[2]  â list[i64] â
ââââââââââââââŞââââââââââââĄ
â {"xx","z"} â [1, 2]    â
â {"x","y"}  â [3]       â
ââââââââââââââ´ââââââââââââ

Select all columns *except* for those that are nested:

>>> df.select(~cs.nested())
shape: (2, 2)
âââââââŹââââââ
â bar â baz â
â --- â --- â
â i64 â f64 â
âââââââŞââââââĄ
â 123 â 2.0 â
â 456 â 5.5 â
âââââââ´ââââââ
)r'   r   r   rC   rN   rR   rQ   rC   rC   $  s    ôp ×$Ń$¤Z×%6Ň%6Ó%8Ó9Đ9rR   c                 óR    [         R                  [        R                  " 5       5      $ )uĆ  
Select all categorical columns.

See Also
--------
by_dtype : Select all columns matching the given dtype(s).
string : Select all string columns (optionally including categoricals).

Examples
--------
>>> import polars.selectors as cs
>>> df = pl.DataFrame(
...     {
...         "foo": ["xx", "yy"],
...         "bar": [123, 456],
...         "baz": [2.0, 5.5],
...     },
...     schema_overrides={"foo": pl.Categorical},
... )

Select all categorical columns:

>>> df.select(cs.categorical())
shape: (2, 1)
âââââââ
â foo â
â --- â
â cat â
âââââââĄ
â xx  â
â yy  â
âââââââ

Select all columns *except* for those that are categorical:

>>> df.select(~cs.categorical())
shape: (2, 2)
âââââââŹââââââ
â bar â baz â
â --- â --- â
â i64 â f64 â
âââââââŞââââââĄ
â 123 â 2.0 â
â 456 â 5.5 â
âââââââ´ââââââ
)r'   r   r   r1   rN   rR   rQ   r1   r1   _  s    ô^ ×$Ń$¤Z×%;Ň%;Ó%=Ó>Đ>rR   c                 óv    [        U 5      nSU S3n[        R                  [        R                  " U5      5      $ )uÜ  
Select columns whose names contain the given literal substring(s).

Parameters
----------
substring
    Substring(s) that matching column names should contain.

See Also
--------
matches : Select all columns that match the given regex pattern.
ends_with : Select columns that end with the given substring(s).
starts_with : Select columns that start with the given substring(s).

Examples
--------
>>> import polars.selectors as cs
>>> df = pl.DataFrame(
...     {
...         "foo": ["x", "y"],
...         "bar": [123, 456],
...         "baz": [2.0, 5.5],
...         "zap": [False, True],
...     }
... )

Select columns that contain the substring 'ba':

>>> df.select(cs.contains("ba"))
shape: (2, 2)
âââââââŹââââââ
â bar â baz â
â --- â --- â
â i64 â f64 â
âââââââŞââââââĄ
â 123 â 2.0 â
â 456 â 5.5 â
âââââââ´ââââââ

Select columns that contain the substring 'ba' or the letter 'z':

>>> df.select(cs.contains("ba", "z"))
shape: (2, 3)
âââââââŹââââââŹââââââââ
â bar â baz â zap   â
â --- â --- â ---   â
â i64 â f64 â bool  â
âââââââŞââââââŞââââââââĄ
â 123 â 2.0 â false â
â 456 â 5.5 â true  â
âââââââ´ââââââ´ââââââââ

Select all columns *except* for those that contain the substring 'ba':

>>> df.select(~cs.contains("ba"))
shape: (2, 2)
âââââââŹââââââââ
â foo â zap   â
â --- â ---   â
â str â bool  â
âââââââŞââââââââĄ
â x   â false â
â y   â true  â
âââââââ´ââââââââ
ú^.*ú.*$Šr'  r'   r   r   rB   )Ú	substringÚescaped_substringÚ
raw_paramss      rQ   r2   r2     s<    ôD # 9Ó-ĐŘĐ(Đ)¨Đ-Jä×$Ń$¤Z×%7Ň%7¸
Ó%CÓDĐDrR   c                 ó"    [        [        /5      $ )uë  
Select all date columns.

See Also
--------
datetime : Select all datetime columns, optionally filtering by time unit/zone.
duration : Select all duration columns, optionally filtering by time unit.
temporal : Select all temporal columns.
time : Select all time columns.

Examples
--------
>>> from datetime import date, datetime, time
>>> import polars.selectors as cs
>>> df = pl.DataFrame(
...     {
...         "dtm": [datetime(2001, 5, 7, 10, 25), datetime(2031, 12, 31, 0, 30)],
...         "dt": [date(1999, 12, 31), date(2024, 8, 9)],
...         "tm": [time(0, 0, 0), time(23, 59, 59)],
...     },
... )

Select all date columns:

>>> df.select(cs.date())
shape: (2, 1)
ââââââââââââââ
â dt         â
â ---        â
â date       â
ââââââââââââââĄ
â 1999-12-31 â
â 2024-08-09 â
ââââââââââââââ

Select all columns *except* for those that are dates:

>>> df.select(~cs.date())
shape: (2, 2)
âââââââââââââââââââââââŹâââââââââââ
â dtm                 â tm       â
â ---                 â ---      â
â datetime[Îźs]        â time     â
âââââââââââââââââââââââŞâââââââââââĄ
â 2001-05-07 10:25:00 â 00:00:00 â
â 2031-12-31 00:30:00 â 23:59:59 â
âââââââââââââââââââââââ´âââââââââââ
)r.   r   rN   rR   rQ   r3   r3   Ů  ó    ôb TFÓĐrR   c                óZ   U c  / SQnO.[        U [        5      (       a  U /O[        R                  " U 5      nUc  S/nOEU(       a>  [        U[        [        R
                  45      (       a  U/O[        R                  " U5      n[        R                  [        R                  " UW5      5      $ )u  
Select all datetime columns, optionally filtering by time unit/zone.

Parameters
----------
time_unit
    One (or more) of the allowed timeunit precision strings, "ms", "us", and "ns".
    Omit to select columns with any valid timeunit.
time_zone
    * One or more timezone strings, as defined in zoneinfo (to see valid options
      run `import zoneinfo; zoneinfo.available_timezones()` for a full list).
    * Set `None` to select Datetime columns that do not have a timezone.
    * Set "*" to select Datetime columns that have *any* timezone.

See Also
--------
date : Select all date columns.
duration : Select all duration columns, optionally filtering by time unit.
temporal : Select all temporal columns.
time : Select all time columns.

Examples
--------
>>> from datetime import datetime, date, timezone
>>> import polars.selectors as cs
>>> from zoneinfo import ZoneInfo
>>> tokyo_tz = ZoneInfo("Asia/Tokyo")
>>> utc_tz = timezone.utc
>>> df = pl.DataFrame(
...     {
...         "tstamp_tokyo": [
...             datetime(1999, 7, 21, 5, 20, 16, 987654, tzinfo=tokyo_tz),
...             datetime(2000, 5, 16, 6, 21, 21, 123465, tzinfo=tokyo_tz),
...         ],
...         "tstamp_utc": [
...             datetime(2023, 4, 10, 12, 14, 16, 999000, tzinfo=utc_tz),
...             datetime(2025, 8, 25, 14, 18, 22, 666000, tzinfo=utc_tz),
...         ],
...         "tstamp": [
...             datetime(2000, 11, 20, 18, 12, 16, 600000),
...             datetime(2020, 10, 30, 10, 20, 25, 123000),
...         ],
...         "dt": [date(1999, 12, 31), date(2010, 7, 5)],
...     },
...     schema_overrides={
...         "tstamp_tokyo": pl.Datetime("ns", "Asia/Tokyo"),
...         "tstamp_utc": pl.Datetime("us", "UTC"),
...     },
... )

Select all datetime columns:

>>> df.select(cs.datetime())
shape: (2, 3)
ââââââââââââââââââââââââââââââââââŹââââââââââââââââââââââââââââââŹââââââââââââââââââââââââââ
â tstamp_tokyo                   â tstamp_utc                  â tstamp                  â
â ---                            â ---                         â ---                     â
â datetime[ns, Asia/Tokyo]       â datetime[Îźs, UTC]           â datetime[Îźs]            â
ââââââââââââââââââââââââââââââââââŞââââââââââââââââââââââââââââââŞââââââââââââââââââââââââââĄ
â 1999-07-21 05:20:16.987654 JST â 2023-04-10 12:14:16.999 UTC â 2000-11-20 18:12:16.600 â
â 2000-05-16 06:21:21.123465 JST â 2025-08-25 14:18:22.666 UTC â 2020-10-30 10:20:25.123 â
ââââââââââââââââââââââââââââââââââ´ââââââââââââââââââââââââââââââ´ââââââââââââââââââââââââââ

Select all datetime columns that have 'us' precision:

>>> df.select(cs.datetime("us"))
shape: (2, 2)
âââââââââââââââââââââââââââââââŹââââââââââââââââââââââââââ
â tstamp_utc                  â tstamp                  â
â ---                         â ---                     â
â datetime[Îźs, UTC]           â datetime[Îźs]            â
âââââââââââââââââââââââââââââââŞââââââââââââââââââââââââââĄ
â 2023-04-10 12:14:16.999 UTC â 2000-11-20 18:12:16.600 â
â 2025-08-25 14:18:22.666 UTC â 2020-10-30 10:20:25.123 â
âââââââââââââââââââââââââââââââ´ââââââââââââââââââââââââââ

Select all datetime columns that have *any* timezone:

>>> df.select(cs.datetime(time_zone="*"))
shape: (2, 2)
ââââââââââââââââââââââââââââââââââŹââââââââââââââââââââââââââââââ
â tstamp_tokyo                   â tstamp_utc                  â
â ---                            â ---                         â
â datetime[ns, Asia/Tokyo]       â datetime[Îźs, UTC]           â
ââââââââââââââââââââââââââââââââââŞââââââââââââââââââââââââââââââĄ
â 1999-07-21 05:20:16.987654 JST â 2023-04-10 12:14:16.999 UTC â
â 2000-05-16 06:21:21.123465 JST â 2025-08-25 14:18:22.666 UTC â
ââââââââââââââââââââââââââââââââââ´ââââââââââââââââââââââââââââââ

Select all datetime columns that have a *specific* timezone:

>>> df.select(cs.datetime(time_zone="UTC"))
shape: (2, 1)
âââââââââââââââââââââââââââââââ
â tstamp_utc                  â
â ---                         â
â datetime[Îźs, UTC]           â
âââââââââââââââââââââââââââââââĄ
â 2023-04-10 12:14:16.999 UTC â
â 2025-08-25 14:18:22.666 UTC â
âââââââââââââââââââââââââââââââ

Select all datetime columns that have NO timezone:

>>> df.select(cs.datetime(time_zone=None))
shape: (2, 1)
âââââââââââââââââââââââââââ
â tstamp                  â
â ---                     â
â datetime[Îźs]            â
âââââââââââââââââââââââââââĄ
â 2000-11-20 18:12:16.600 â
â 2020-10-30 10:20:25.123 â
âââââââââââââââââââââââââââ

Select all columns *except* for datetime columns:

>>> df.select(~cs.datetime())
shape: (2, 1)
ââââââââââââââ
â dt         â
â ---        â
â date       â
ââââââââââââââĄ
â 1999-12-31 â
â 2010-07-05 â
ââââââââââââââ
NŠÚmsÚusÚns)
rU   r   rĂ   rA   rČ   Útimezoner'   r   r   r4   )rˇ   r¸   Útime_unit_lstÚtime_zone_lsts       rQ   r4   r4     s    đR ŃÚ*ô & i´×5Ń5YKź8ż=ş=ČÓ;Sđ 	đ
 ŃŘŢ	ô )¤cŹ:×+>Ń+>Đ%?×@Ń@đ KäyÓ)đ 	ô ×$Ń$¤Z×%8Ň%8¸ČÓ%VÓWĐWrR   c                 óR    [         R                  [        R                  " 5       5      $ )uë  
Select all decimal columns.

See Also
--------
float : Select all float columns.
integer : Select all integer columns.
numeric : Select all numeric columns.

Examples
--------
>>> from decimal import Decimal as D
>>> import polars.selectors as cs
>>> df = pl.DataFrame(
...     {
...         "foo": ["x", "y"],
...         "bar": [D(123), D(456)],
...         "baz": [D("2.0005"), D("-50.5555")],
...     },
...     schema_overrides={"baz": pl.Decimal(scale=5, precision=10)},
... )

Select all decimal columns:

>>> df.select(cs.decimal())
shape: (2, 2)
ââââââââââââââââŹââââââââââââââââ
â bar          â baz           â
â ---          â ---           â
â decimal[*,0] â decimal[10,5] â
ââââââââââââââââŞââââââââââââââââĄ
â 123          â 2.00050       â
â 456          â -50.55550     â
ââââââââââââââââ´ââââââââââââââââ

Select all columns *except* the decimal ones:

>>> df.select(~cs.decimal())
shape: (2, 1)
âââââââ
â foo â
â --- â
â str â
âââââââĄ
â x   â
â y   â
âââââââ
)r'   r   r   r5   rN   rR   rQ   r5   r5   Ş  ó    ôd ×$Ń$¤Z×%7Ň%7Ó%9Ó:Đ:rR   c                ór    U (       a  SOSn[         R                  [        R                  " SU S35      5      $ )uR	  
Select all columns having names consisting only of digits.

Notes
-----
Matching column names cannot contain *any* non-digit characters. Note that the
definition of "digit" consists of all valid Unicode digit characters (`\d`)
by default; this can be changed by setting `ascii_only=True`.

Examples
--------
>>> import polars as pl
>>> import polars.selectors as cs
>>> df = pl.DataFrame(
...     {
...         "key": ["aaa", "bbb", "aaa", "bbb", "bbb"],
...         "year": [2001, 2001, 2025, 2025, 2001],
...         "value": [-25, 100, 75, -15, -5],
...     }
... ).pivot(
...     values="value",
...     index="key",
...     on="year",
...     aggregate_function="sum",
... )
>>> print(df)
shape: (2, 3)
âââââââŹâââââââŹâââââââ
â key â 2001 â 2025 â
â --- â ---  â ---  â
â str â i64  â i64  â
âââââââŞâââââââŞâââââââĄ
â aaa â -25  â 75   â
â bbb â 95   â -15  â
âââââââ´âââââââ´âââââââ

Select columns with digit names:

>>> df.select(cs.digit())
shape: (2, 2)
ââââââââŹâââââââ
â 2001 â 2025 â
â ---  â ---  â
â i64  â i64  â
ââââââââŞâââââââĄ
â -25  â 75   â
â 95   â -15  â
ââââââââ´âââââââ

Select all columns *except* for those with digit names:

>>> df.select(~cs.digit())
shape: (2, 1)
âââââââ
â key â
â --- â
â str â
âââââââĄ
â aaa â
â bbb â
âââââââ

Demonstrate use of `ascii_only` flag (by default all valid unicode digits
are considered, but this can be constrained to ascii 0-9):

>>> df = pl.DataFrame({"ŕĽ§ŕĽŻŕĽŻŕĽŻ": [1999], "ŕĽ¨ŕĽŚŕĽ­ŕĽ­": [2077], "3000": [3000]})
>>> df.select(cs.digit())
shape: (1, 3)
ââââââââŹâââââââŹâââââââ
â ŕĽ§ŕĽŻŕĽŻŕĽŻ â ŕĽ¨ŕĽŚŕĽ­ŕĽ­ â 3000 â
â ---  â ---  â ---  â
â i64  â i64  â i64  â
ââââââââŞâââââââŞâââââââĄ
â 1999 â 2077 â 3000 â
ââââââââ´âââââââ´âââââââ

>>> df.select(cs.digit(ascii_only=True))
shape: (1, 1)
ââââââââ
â 3000 â
â ---  â
â i64  â
ââââââââĄ
â 3000 â
ââââââââ
z[0-9]r7  r~   z+$r2  )r3  r8  s     rQ   r6   r6   ß  s3    ön &x¨5HÜ×$Ń$¤Z×%7Ň%7¸1¸X¸JŔbĐ8IÓ%JÓKĐKrR   c                óŔ    U c  / SQn O.[        U [        5      (       a  U /O[        R                  " U 5      n [        R                  [        R                  " U 5      5      $ )u  
Select all duration columns, optionally filtering by time unit.

Parameters
----------
time_unit
    One (or more) of the allowed timeunit precision strings, "ms", "us", and "ns".
    Omit to select columns with any valid timeunit.

See Also
--------
date : Select all date columns.
datetime : Select all datetime columns, optionally filtering by time unit/zone.
temporal : Select all temporal columns.
time : Select all time columns.

Examples
--------
>>> from datetime import date, timedelta
>>> import polars.selectors as cs
>>> df = pl.DataFrame(
...     {
...         "dt": [date(2022, 1, 31), date(2025, 7, 5)],
...         "td1": [
...             timedelta(days=1, milliseconds=123456),
...             timedelta(days=1, hours=23, microseconds=987000),
...         ],
...         "td2": [
...             timedelta(days=7, microseconds=456789),
...             timedelta(days=14, minutes=999, seconds=59),
...         ],
...         "td3": [
...             timedelta(weeks=4, days=-10, microseconds=999999),
...             timedelta(weeks=3, milliseconds=123456, microseconds=1),
...         ],
...     },
...     schema_overrides={
...         "td1": pl.Duration("ms"),
...         "td2": pl.Duration("us"),
...         "td3": pl.Duration("ns"),
...     },
... )

Select all duration columns:

>>> df.select(cs.duration())
shape: (2, 3)
ââââââââââââââââââŹââââââââââââââââââŹâââââââââââââââââââââ
â td1            â td2             â td3                â
â ---            â ---             â ---                â
â duration[ms]   â duration[Îźs]    â duration[ns]       â
ââââââââââââââââââŞââââââââââââââââââŞâââââââââââââââââââââĄ
â 1d 2m 3s 456ms â 7d 456789Âľs     â 18d 999999Âľs       â
â 1d 23h 987ms   â 14d 16h 39m 59s â 21d 2m 3s 456001Âľs â
ââââââââââââââââââ´ââââââââââââââââââ´âââââââââââââââââââââ

Select all duration columns that have 'ms' precision:

>>> df.select(cs.duration("ms"))
shape: (2, 1)
ââââââââââââââââââ
â td1            â
â ---            â
â duration[ms]   â
ââââââââââââââââââĄ
â 1d 2m 3s 456ms â
â 1d 23h 987ms   â
ââââââââââââââââââ

Select all duration columns that have 'ms' OR 'ns' precision:

>>> df.select(cs.duration(["ms", "ns"]))
shape: (2, 2)
ââââââââââââââââââŹâââââââââââââââââââââ
â td1            â td3                â
â ---            â ---                â
â duration[ms]   â duration[ns]       â
ââââââââââââââââââŞâââââââââââââââââââââĄ
â 1d 2m 3s 456ms â 18d 999999Âľs       â
â 1d 23h 987ms   â 21d 2m 3s 456001Âľs â
ââââââââââââââââââ´âââââââââââââââââââââ

Select all columns *except* for duration columns:

>>> df.select(~cs.duration())
shape: (2, 1)
ââââââââââââââ
â dt         â
â ---        â
â date       â
ââââââââââââââĄ
â 2022-01-31 â
â 2025-07-05 â
ââââââââââââââ
r]  )rU   r   rĂ   rA   r'   r   r   r7   )rˇ   s    rQ   r7   r7   :  sQ    đD ŃÚ&	ô & i´×5Ń5YKź8ż=ş=ČÓ;Sđ 	ô ×$Ń$¤Z×%8Ň%8¸Ó%CÓDĐDrR   c                 óv    [        U 5      nSU S3n[        R                  [        R                  " U5      5      $ )uS  
Select columns that end with the given substring(s).

See Also
--------
contains : Select columns that contain the given literal substring(s).
matches : Select all columns that match the given regex pattern.
starts_with : Select columns that start with the given substring(s).

Parameters
----------
suffix
    Substring(s) that matching column names should end with.

Examples
--------
>>> import polars.selectors as cs
>>> df = pl.DataFrame(
...     {
...         "foo": ["x", "y"],
...         "bar": [123, 456],
...         "baz": [2.0, 5.5],
...         "zap": [False, True],
...     }
... )

Select columns that end with the substring 'z':

>>> df.select(cs.ends_with("z"))
shape: (2, 1)
âââââââ
â baz â
â --- â
â f64 â
âââââââĄ
â 2.0 â
â 5.5 â
âââââââ

Select columns that end with *either* the letter 'z' or 'r':

>>> df.select(cs.ends_with("z", "r"))
shape: (2, 2)
âââââââŹââââââ
â bar â baz â
â --- â --- â
â i64 â f64 â
âââââââŞââââââĄ
â 123 â 2.0 â
â 456 â 5.5 â
âââââââ´ââââââ

Select all columns *except* for those that end with the substring 'z':

>>> df.select(~cs.ends_with("z"))
shape: (2, 3)
âââââââŹââââââŹââââââââ
â foo â bar â zap   â
â --- â --- â ---   â
â str â i64 â bool  â
âââââââŞââââââŞââââââââĄ
â x   â 123 â false â
â y   â 456 â true  â
âââââââ´ââââââ´ââââââââ
rT  r   rV  )ÚsuffixÚescaped_suffixrY  s      rQ   r8   r8   Ś  s:    ôD   Ó'NŘ~Đ& aĐ(Jä×$Ń$¤Z×%7Ň%7¸
Ó%CÓDĐDrR   c                ó    [        U /UQ76 ) $ )uă  
Select all columns except those matching the given columns, datatypes, or selectors.

Parameters
----------
columns
    One or more columns (col or name), datatypes, columns, or selectors representing
    the columns to exclude.
*more_columns
    Additional columns, datatypes, or selectors to exclude, specified as positional
    arguments.

Notes
-----
If excluding a single selector it is simpler to write as `~selector` instead.

Examples
--------
Exclude by column name(s):

>>> import polars.selectors as cs
>>> df = pl.DataFrame(
...     {
...         "aa": [1, 2, 3],
...         "ba": ["a", "b", None],
...         "cc": [None, 2.5, 1.5],
...     }
... )
>>> df.select(cs.exclude("ba", "xx"))
shape: (3, 2)
âââââââŹâââââââ
â aa  â cc   â
â --- â ---  â
â i64 â f64  â
âââââââŞâââââââĄ
â 1   â null â
â 2   â 2.5  â
â 3   â 1.5  â
âââââââ´âââââââ

Exclude using a column name, a selector, and a dtype:

>>> df.select(cs.exclude("aa", cs.string(), pl.UInt32))
shape: (3, 1)
ââââââââ
â cc   â
â ---  â
â f64  â
ââââââââĄ
â null â
â 2.5  â
â 1.5  â
ââââââââ
)r   )r  r  s     rQ   r:   r:   î  s    ô@ ! Đ8¨<Ň8Đ8Đ8rR   c                óT    [         R                  [        R                  " U 5      5      $ )uĆ  
Select the first column in the current scope.

See Also
--------
all : Select all columns.
last : Select the last column in the current scope.

Examples
--------
>>> import polars.selectors as cs
>>> df = pl.DataFrame(
...     {
...         "foo": ["x", "y"],
...         "bar": [123, 456],
...         "baz": [2.0, 5.5],
...         "zap": [0, 1],
...     }
... )

Select the first column:

>>> df.select(cs.first())
shape: (2, 1)
âââââââ
â foo â
â --- â
â str â
âââââââĄ
â x   â
â y   â
âââââââ

Select everything  *except* for the first column:

>>> df.select(~cs.first())
shape: (2, 3)
âââââââŹââââââŹââââââ
â bar â baz â zap â
â --- â --- â --- â
â i64 â f64 â i64 â
âââââââŞââââââŞââââââĄ
â 123 â 2.0 â 0   â
â 456 â 5.5 â 1   â
âââââââ´ââââââ´ââââââ
)r'   r   r   r<   rV   s    rQ   r<   r<   1	  s!    ô^ ×$Ń$¤Z×%5Ň%5°fÓ%=Ó>Đ>rR   c                 óR    [         R                  [        R                  " 5       5      $ )ug  
Select all float columns.

See Also
--------
integer : Select all integer columns.
numeric : Select all numeric columns.
signed_integer : Select all signed integer columns.
unsigned_integer : Select all unsigned integer columns.

Examples
--------
>>> import polars.selectors as cs
>>> df = pl.DataFrame(
...     {
...         "foo": ["x", "y"],
...         "bar": [123, 456],
...         "baz": [2.0, 5.5],
...         "zap": [0.0, 1.0],
...     },
...     schema_overrides={"baz": pl.Float32, "zap": pl.Float64},
... )

Select all float columns:

>>> df.select(cs.float())
shape: (2, 2)
âââââââŹââââââ
â baz â zap â
â --- â --- â
â f32 â f64 â
âââââââŞââââââĄ
â 2.0 â 0.0 â
â 5.5 â 1.0 â
âââââââ´ââââââ

Select all columns *except* for those that are float:

>>> df.select(~cs.float())
shape: (2, 2)
âââââââŹââââââ
â foo â bar â
â --- â --- â
â str â i64 â
âââââââŞââââââĄ
â x   â 123 â
â y   â 456 â
âââââââ´ââââââ
)r'   r   r   r=   rN   rR   rQ   r=   r=   c	  s    ôd ×$Ń$¤Z×%5Ň%5Ó%7Ó8Đ8rR   c                 óR    [         R                  [        R                  " 5       5      $ )uL  
Select all integer columns.

See Also
--------
by_dtype : Select columns by dtype.
float : Select all float columns.
numeric : Select all numeric columns.
signed_integer : Select all signed integer columns.
unsigned_integer : Select all unsigned integer columns.

Examples
--------
>>> import polars.selectors as cs
>>> df = pl.DataFrame(
...     {
...         "foo": ["x", "y"],
...         "bar": [123, 456],
...         "baz": [2.0, 5.5],
...         "zap": [0, 1],
...     }
... )

Select all integer columns:

>>> df.select(cs.integer())
shape: (2, 2)
âââââââŹââââââ
â bar â zap â
â --- â --- â
â i64 â i64 â
âââââââŞââââââĄ
â 123 â 0   â
â 456 â 1   â
âââââââ´ââââââ

Select all columns *except* for those that are integer :

>>> df.select(~cs.integer())
shape: (2, 2)
âââââââŹââââââ
â foo â baz â
â --- â --- â
â str â f64 â
âââââââŞââââââĄ
â x   â 2.0 â
â y   â 5.5 â
âââââââ´ââââââ
)r'   r   r   r>   rN   rR   rQ   r>   r>   	  re  rR   c                 óR    [         R                  [        R                  " 5       5      $ )u]  
Select all signed integer columns.

See Also
--------
by_dtype : Select columns by dtype.
float : Select all float columns.
integer : Select all integer columns.
numeric : Select all numeric columns.
unsigned_integer : Select all unsigned integer columns.

Examples
--------
>>> import polars.selectors as cs
>>> df = pl.DataFrame(
...     {
...         "foo": [-123, -456],
...         "bar": [3456, 6789],
...         "baz": [7654, 4321],
...         "zap": ["ab", "cd"],
...     },
...     schema_overrides={"bar": pl.UInt32, "baz": pl.UInt64},
... )

Select all signed integer columns:

>>> df.select(cs.signed_integer())
shape: (2, 1)
ââââââââ
â foo  â
â ---  â
â i64  â
ââââââââĄ
â -123 â
â -456 â
ââââââââ

>>> df.select(~cs.signed_integer())
shape: (2, 3)
ââââââââŹâââââââŹââââââ
â bar  â baz  â zap â
â ---  â ---  â --- â
â u32  â u64  â str â
ââââââââŞâââââââŞââââââĄ
â 3456 â 7654 â ab  â
â 6789 â 4321 â cd  â
ââââââââ´âââââââ´ââââââ

Select all integer columns (both signed and unsigned):

>>> df.select(cs.integer())
shape: (2, 3)
ââââââââŹâââââââŹâââââââ
â foo  â bar  â baz  â
â ---  â ---  â ---  â
â i64  â u32  â u64  â
ââââââââŞâââââââŞâââââââĄ
â -123 â 3456 â 7654 â
â -456 â 6789 â 4321 â
ââââââââ´âââââââ´âââââââ
)r'   r   r   rE   rN   rR   rQ   rE   rE   Í	  s    ô| ×$Ń$¤Z×%>Ň%>Ó%@ÓAĐArR   c                 óR    [         R                  [        R                  " 5       5      $ )u¤  
Select all unsigned integer columns.

See Also
--------
by_dtype : Select columns by dtype.
float : Select all float columns.
integer : Select all integer columns.
numeric : Select all numeric columns.
signed_integer : Select all signed integer columns.

Examples
--------
>>> import polars.selectors as cs
>>> df = pl.DataFrame(
...     {
...         "foo": [-123, -456],
...         "bar": [3456, 6789],
...         "baz": [7654, 4321],
...         "zap": ["ab", "cd"],
...     },
...     schema_overrides={"bar": pl.UInt32, "baz": pl.UInt64},
... )

Select all unsigned integer columns:

>>> df.select(cs.unsigned_integer())
shape: (2, 2)
ââââââââŹâââââââ
â bar  â baz  â
â ---  â ---  â
â u32  â u64  â
ââââââââŞâââââââĄ
â 3456 â 7654 â
â 6789 â 4321 â
ââââââââ´âââââââ

Select all columns *except* for those that are unsigned integers:

>>> df.select(~cs.unsigned_integer())
shape: (2, 2)
ââââââââŹââââââ
â foo  â zap â
â ---  â --- â
â i64  â str â
ââââââââŞââââââĄ
â -123 â ab  â
â -456 â cd  â
ââââââââ´ââââââ

Select all integer columns (both signed and unsigned):

>>> df.select(cs.integer())
shape: (2, 3)
ââââââââŹâââââââŹâââââââ
â foo  â bar  â baz  â
â ---  â ---  â ---  â
â i64  â u32  â u64  â
ââââââââŞâââââââŞâââââââĄ
â -123 â 3456 â 7654 â
â -456 â 6789 â 4321 â
ââââââââ´âââââââ´âââââââ
)r'   r   r   rK   rN   rR   rQ   rK   rK   
  s    ô@ ×$Ń$¤Z×%@Ň%@Ó%BÓCĐCrR   c                óT    [         R                  [        R                  " U 5      5      $ )uĂ  
Select the last column in the current scope.

See Also
--------
all : Select all columns.
first : Select the first column in the current scope.

Examples
--------
>>> import polars.selectors as cs
>>> df = pl.DataFrame(
...     {
...         "foo": ["x", "y"],
...         "bar": [123, 456],
...         "baz": [2.0, 5.5],
...         "zap": [0, 1],
...     }
... )

Select the last column:

>>> df.select(cs.last())
shape: (2, 1)
âââââââ
â zap â
â --- â
â i64 â
âââââââĄ
â 0   â
â 1   â
âââââââ

Select everything  *except* for the last column:

>>> df.select(~cs.last())
shape: (2, 3)
âââââââŹââââââŹââââââ
â foo â bar â baz â
â --- â --- â --- â
â str â i64 â f64 â
âââââââŞââââââŞââââââĄ
â x   â 123 â 2.0 â
â y   â 456 â 5.5 â
âââââââ´ââââââ´ââââââ
)r'   r   r   r@   rV   s    rQ   r@   r@   Q
  s    ô^ ×$Ń$¤Z§_˘_°VÓ%<Ó=Đ=rR   c                óZ   U S:X  a
  [        5       $ U R                  S5      (       a  U SS n OU R                  S5      (       a  U SS n U R                  S5      (       d  SOSnU R                  S5      (       d  S	OSnU U  U 3n[        R	                  [
        R                  " U5      5      $ )
uC  
Select all columns that match the given regex pattern.

See Also
--------
contains : Select all columns that contain the given substring.
ends_with : Select all columns that end with the given substring(s).
starts_with : Select all columns that start with the given substring(s).

Parameters
----------
pattern
    A valid regular expression pattern, compatible with the `regex crate
    <https://docs.rs/regex/latest/regex/>`_.

Examples
--------
>>> import polars.selectors as cs
>>> df = pl.DataFrame(
...     {
...         "foo": ["x", "y"],
...         "bar": [123, 456],
...         "baz": [2.0, 5.5],
...         "zap": [0, 1],
...     }
... )

Match column names containing an 'a', preceded by a character that is not 'z':

>>> df.select(cs.matches("[^z]a"))
shape: (2, 2)
âââââââŹââââââ
â bar â baz â
â --- â --- â
â i64 â f64 â
âââââââŞââââââĄ
â 123 â 2.0 â
â 456 â 5.5 â
âââââââ´ââââââ

Do not match column names ending in 'R' or 'z' (case-insensitively):

>>> df.select(~cs.matches(r"(?i)R|z$"))
shape: (2, 2)
âââââââŹââââââ
â foo â zap â
â --- â --- â
â str â i64 â
âââââââŞââââââĄ
â x   â 0   â
â y   â 1   â
âââââââ´ââââââ
z.*é   Néţ˙˙˙r~   rT  rš   r   rU  )r(   r   r   r'   r   r   rB   )ÚpatternÚpfxÚsfxrY  s       rQ   rB   rB   
  s§    đl $Üuŕ×Ńd×#Ń#ŘabkGŘ×Ńd×#Ń#ŘcrlGŕ"×-Ń-¨c×2Ń2e¸Ř"×+Ń+¨C×0Ń0e°bŘuWI c UĐ+
ä×(Ń(Ź×);Ň);¸JÓ)GÓHĐHrR   c                 óR    [         R                  [        R                  " 5       5      $ )u  
Select all numeric columns.

See Also
--------
by_dtype : Select columns by dtype.
float : Select all float columns.
integer : Select all integer columns.
signed_integer : Select all signed integer columns.
unsigned_integer : Select all unsigned integer columns.

Examples
--------
>>> import polars.selectors as cs
>>> df = pl.DataFrame(
...     {
...         "foo": ["x", "y"],
...         "bar": [123, 456],
...         "baz": [2.0, 5.5],
...         "zap": [0, 0],
...     },
...     schema_overrides={"bar": pl.Int16, "baz": pl.Float32, "zap": pl.UInt8},
... )

Match all numeric columns:

>>> df.select(cs.numeric())
shape: (2, 3)
âââââââŹââââââŹââââââ
â bar â baz â zap â
â --- â --- â --- â
â i16 â f32 â u8  â
âââââââŞââââââŞââââââĄ
â 123 â 2.0 â 0   â
â 456 â 5.5 â 0   â
âââââââ´ââââââ´ââââââ

Match all columns *except* for those that are numeric:

>>> df.select(~cs.numeric())
shape: (2, 1)
âââââââ
â foo â
â --- â
â str â
âââââââĄ
â x   â
â y   â
âââââââ
)r'   r   r   rD   rN   rR   rQ   rD   rD   Č
  s    ôf ×$Ń$¤Z×%7Ň%7Ó%9Ó:Đ:rR   c                 óR    [         R                  [        R                  " 5       5      $ )uď  
Select all object columns.

See Also
--------
by_dtype : Select columns by dtype.

Examples
--------
>>> import polars.selectors as cs
>>> from uuid import uuid4
>>> with pl.Config(fmt_str_lengths=36):
...     df = pl.DataFrame(
...         {
...             "idx": [0, 1],
...             "uuid_obj": [uuid4(), uuid4()],
...             "uuid_str": [str(uuid4()), str(uuid4())],
...         },
...         schema_overrides={"idx": pl.Int32},
...     )
...     print(df)  # doctest: +IGNORE_RESULT
shape: (2, 3)
âââââââŹâââââââââââââââââââââââââââââââââââââââŹâââââââââââââââââââââââââââââââââââââââ
â idx â uuid_obj                             â uuid_str                             â
â --- â ---                                  â ---                                  â
â i32 â object                               â str                                  â
âââââââŞâââââââââââââââââââââââââââââââââââââââŞâââââââââââââââââââââââââââââââââââââââĄ
â 0   â 6be063cf-c9c6-43be-878e-e446cfd42981 â acab9fea-c05d-4b91-b639-418004a63f33 â
â 1   â 7849d8f9-2cac-48e7-96d3-63cf81c14869 â 28c65415-8b7d-4857-a4ce-300dca14b12b â
âââââââ´âââââââââââââââââââââââââââââââââââââââ´âââââââââââââââââââââââââââââââââââââââ

Select object columns and export as a dict:

>>> df.select(cs.object()).to_dict(as_series=False)  # doctest: +IGNORE_RESULT
{
    "uuid_obj": [
        UUID("6be063cf-c9c6-43be-878e-e446cfd42981"),
        UUID("7849d8f9-2cac-48e7-96d3-63cf81c14869"),
    ]
}

Select all columns *except* for those that are object and export as dict:

>>> df.select(~cs.object())  # doctest: +IGNORE_RESULT
{
    "idx": [0, 1],
    "uuid_str": [
        "acab9fea-c05d-4b91-b639-418004a63f33",
        "28c65415-8b7d-4857-a4ce-300dca14b12b",
    ],
}
)r'   r   r   rĆ   rN   rR   rQ   rĆ   rĆ   ţ
  s    ôj ×$Ń$¤Z×%6Ň%6Ó%8Ó9Đ9rR   c                 óv    [        U 5      nSU S3n[        R                  [        R                  " U5      5      $ )up  
Select columns that start with the given substring(s).

Parameters
----------
prefix
    Substring(s) that matching column names should start with.

See Also
--------
contains : Select all columns that contain the given substring.
ends_with : Select all columns that end with the given substring(s).
matches : Select all columns that match the given regex pattern.

Examples
--------
>>> import polars.selectors as cs
>>> df = pl.DataFrame(
...     {
...         "foo": [1.0, 2.0],
...         "bar": [3.0, 4.0],
...         "baz": [5, 6],
...         "zap": [7, 8],
...     }
... )

Match columns starting with a 'b':

>>> df.select(cs.starts_with("b"))
shape: (2, 2)
âââââââŹââââââ
â bar â baz â
â --- â --- â
â f64 â i64 â
âââââââŞââââââĄ
â 3.0 â 5   â
â 4.0 â 6   â
âââââââ´ââââââ

Match columns starting with *either* the letter 'b' or 'z':

>>> df.select(cs.starts_with("b", "z"))
shape: (2, 3)
âââââââŹââââââŹââââââ
â bar â baz â zap â
â --- â --- â --- â
â f64 â i64 â i64 â
âââââââŞââââââŞââââââĄ
â 3.0 â 5   â 7   â
â 4.0 â 6   â 8   â
âââââââ´ââââââ´ââââââ

Match all columns *except* for those starting with 'b':

>>> df.select(~cs.starts_with("b"))
shape: (2, 2)
âââââââŹââââââ
â foo â zap â
â --- â --- â
â f64 â i64 â
âââââââŞââââââĄ
â 1.0 â 7   â
â 2.0 â 8   â
âââââââ´ââââââ
r~   rU  rV  )ÚprefixÚescaped_prefixrY  s      rQ   rF   rF   6  s:    ôD   Ó'NŘ^Đ$ CĐ(Jä×$Ń$¤Z×%7Ň%7¸
Ó%CÓDĐDrR   )Úinclude_categoricalc                ó^    [         /nU (       a  UR                  [        5        [        U5      $ )uş  
Select all String (and, optionally, Categorical) string columns.

See Also
--------
binary : Select all binary columns.
by_dtype : Select all columns matching the given dtype(s).
categorical: Select all categorical columns.

Examples
--------
>>> import polars.selectors as cs
>>> df = pl.DataFrame(
...     {
...         "w": ["xx", "yy", "xx", "yy", "xx"],
...         "x": [1, 2, 1, 4, -2],
...         "y": [3.0, 4.5, 1.0, 2.5, -2.0],
...         "z": ["a", "b", "a", "b", "b"],
...     },
... ).with_columns(
...     z=pl.col("z").cast(pl.Categorical("lexical")),
... )

Group by all string columns, sum the numeric columns, then sort by the string cols:

>>> df.group_by(cs.string()).agg(cs.numeric().sum()).sort(by=cs.string())
shape: (2, 3)
âââââââŹââââââŹââââââ
â w   â x   â y   â
â --- â --- â --- â
â str â i64 â f64 â
âââââââŞââââââŞââââââĄ
â xx  â 0   â 2.0 â
â yy  â 6   â 7.0 â
âââââââ´ââââââ´ââââââ

Group by all string *and* categorical columns:

>>> df.group_by(cs.string(include_categorical=True)).agg(cs.numeric().sum()).sort(
...     by=cs.string(include_categorical=True)
... )
shape: (3, 4)
âââââââŹââââââŹââââââŹâââââââ
â w   â z   â x   â y    â
â --- â --- â --- â ---  â
â str â cat â i64 â f64  â
âââââââŞââââââŞââââââŞâââââââĄ
â xx  â a   â 2   â 4.0  â
â xx  â b   â -2  â -2.0 â
â yy  â b   â 6   â 7.0  â
âââââââ´ââââââ´ââââââ´âââââââ
)r   rh   r   r.   )r}  Ústring_dtypess     rQ   rG   rG   ~  s(    ôj 5;°8MŢŘ×Ń[Ô)äMÓ"Đ"rR   c                 óR    [         R                  [        R                  " 5       5      $ )u  
Select all temporal columns.

See Also
--------
by_dtype : Select all columns matching the given dtype(s).
date : Select all date columns.
datetime : Select all datetime columns, optionally filtering by time unit/zone.
duration : Select all duration columns, optionally filtering by time unit.
time : Select all time columns.

Examples
--------
>>> from datetime import date, time
>>> import polars.selectors as cs
>>> df = pl.DataFrame(
...     {
...         "dt": [date(2021, 1, 1), date(2021, 1, 2)],
...         "tm": [time(12, 0, 0), time(20, 30, 45)],
...         "value": [1.2345, 2.3456],
...     }
... )

Match all temporal columns:

>>> df.select(cs.temporal())
shape: (2, 2)
ââââââââââââââŹâââââââââââ
â dt         â tm       â
â ---        â ---      â
â date       â time     â
ââââââââââââââŞâââââââââââĄ
â 2021-01-01 â 12:00:00 â
â 2021-01-02 â 20:30:45 â
ââââââââââââââ´âââââââââââ

Match all temporal columns *except* for time columns:

>>> df.select(cs.temporal() - cs.time())
shape: (2, 1)
ââââââââââââââ
â dt         â
â ---        â
â date       â
ââââââââââââââĄ
â 2021-01-01 â
â 2021-01-02 â
ââââââââââââââ

Match all columns *except* for temporal columns:

>>> df.select(~cs.temporal())
shape: (2, 1)
ââââââââââ
â value  â
â ---    â
â f64    â
ââââââââââĄ
â 1.2345 â
â 2.3456 â
ââââââââââ
)r'   r   r   rI   rN   rR   rQ   rI   rI   ş  s    ô~ ×$Ń$¤Z×%8Ň%8Ó%:Ó;Đ;rR   c                 ó"    [        [        /5      $ )uë  
Select all time columns.

See Also
--------
date : Select all date columns.
datetime : Select all datetime columns, optionally filtering by time unit/zone.
duration : Select all duration columns, optionally filtering by time unit.
temporal : Select all temporal columns.

Examples
--------
>>> from datetime import date, datetime, time
>>> import polars.selectors as cs
>>> df = pl.DataFrame(
...     {
...         "dtm": [datetime(2001, 5, 7, 10, 25), datetime(2031, 12, 31, 0, 30)],
...         "dt": [date(1999, 12, 31), date(2024, 8, 9)],
...         "tm": [time(0, 0, 0), time(23, 59, 59)],
...     },
... )

Select all time columns:

>>> df.select(cs.time())
shape: (2, 1)
ââââââââââââ
â tm       â
â ---      â
â time     â
ââââââââââââĄ
â 00:00:00 â
â 23:59:59 â
ââââââââââââ

Select all columns *except* for those that are times:

>>> df.select(~cs.time())
shape: (2, 2)
âââââââââââââââââââââââŹâââââââââââââ
â dtm                 â dt         â
â ---                 â ---        â
â datetime[Îźs]        â date       â
âââââââââââââââââââââââŞâââââââââââââĄ
â 2001-05-07 10:25:00 â 1999-12-31 â
â 2031-12-31 00:30:00 â 2024-08-09 â
âââââââââââââââââââââââ´âââââââââââââ
)r.   r   rN   rR   rQ   rJ   rJ   ü  r[  rR   )rP   r'   r  zLiteral[True])rP   r   r  zLiteral[False])rP   r   r  rÄ   )rc   z4DataFrame | LazyFrame | Mapping[str, PolarsDataType]rd   r  rW   rÄ   r  ztuple[str, ...])ri   zDataFrame | LazyFramerj   r   r  zbuiltins.list[Any])ru   r"   rv   zMapping[Any, Any] | Nonerw   rÄ   rx   rÄ   rp   rÄ   r  zdict[str, Any])rj   z[str | Expr | PolarsDataType | Selector | Collection[str | Expr | PolarsDataType | Selector]r   z&str | Expr | PolarsDataType | Selectorr  r'   )rG   ústr | Collection[str]r   rÄ   r  r   r  )F)r3  rÄ   r+  rÄ   r  r'   )r   zUPolarsDataType | PythonDataType | Iterable[PolarsDataType] | Iterable[PythonDataType]r  r'   )rA  z#int | range | Sequence[int | range]r   rÄ   r  r'   )r   r  r   rÄ   r  r'   rM   )rK  zNone | Selectorr  r'   )rK  zSelector | NonerM  z
int | Noner  r'   )rW  r   r  r'   )N)rś   N)rˇ   ú&TimeUnit | Collection[TimeUnit] | Noner¸   zOstr | pydatetime.timezone | Collection[str | pydatetime.timezone | None] | Noner  r'   )r3  rÄ   r  r'   )rˇ   r  r  r'   )ri  r   r  r'   )r  z[str | PolarsDataType | Selector | Expr | Collection[str | PolarsDataType | Selector | Expr]r  z&str | PolarsDataType | Selector | Exprr  r'   )rW   rÄ   r  r'   )ru  r   r  r'   )r{  r   r  r'   )r}  rÄ   r  r'   )jÚ
__future__r   rĂ   Ú
contextlibr4   rČ   ÚsysÚcollections.abcr   r   r   r5   r   rĘ   Ú	functoolsr   Úoperatorr	   Útypingr
   r   r   r   r   Úpolars.datatypes.classesÚ	datatypesÚclassesrş   Úpolarsr   r§   Úpolars._utils.parse.exprr   Úpolars._utils.unstabler   Úpolars._utils.variousr   r   Úpolars.datatypesr   r   r   r   r   r   r   Úpolars.exprr   ÚsuppressÚImportErrorÚpolars._plrr   r   Úversion_infoÚtypesr    rÁ   r!   r"   r#   Úpolars._typingr$   r%   r&   Ú__all__r?   r;   ro   r|   r   r'   r'  r)  r(   r)   r*   r,   r-   r.   r/   r0   r9   rA   r+   rH   rC   r1   r2   r3   r6   r7   r8   r:   r<   r=   r>   rE   rK   r@   rB   rD   rĆ   rF   rG   rI   rJ   rN   rR   rQ   Ú<module>r     sŐ  đÝ "ă Ű Ű Ű 
ß 9Ń 9Ý (Ý Ý ÷ő ÷ (Đ 'Ý !Ý >Ý +ß 6÷÷ ń ő ŕ×ŇŐ%ß.÷ &đ ×ŃwÓŢń DzHćÝ(ç+ßGŃGň(đV 
Ű 4ó 
Ř 4đ 
Ű 0ó 
Ř 0ô%đ, ń	L;Ř@đL;ŕđL;đ đ	L;đ
 őL;ôb đR ńŘđŕđđ đ	đ
 đđ đđ őđ24!đ	=đ4!đ 8đ4!đ ô4!ôny/tô y/đx	 AE÷ ô9ô,/7đdhW¸U÷ hWđ hWđX đ_đ  ń_Řđ_đ đ_đ ö	_ôD!ôH7đtS*đ	#đS*đ ôS*đn HLńbTŘ1đbTŘ@DđbTŕőbTđJ @D÷ Y<ńx 
ó49ó đ49ńn 
őF?ó đF?ńR 
đVGŔ÷ VGó đVGńr 
ó4;ó đ4;ńn 
ó7:ó đ7:ôt/?ôdEEôP1đj 9=đ	đ	ZXŘ5đZXđ 	XđZXđ őZXôz2;öjXLđx 9=điEŘ5điEŕőiEôXEEđP@9đ	=đ@9đ :đ@9đ ô@9đF !÷ /?ôd29ôj2;ôj>BôB@DđF  ÷ />ôdBIôJ3;ôl5:ôpEEđP +0÷ 9#ôx?<őD1÷s^ &Ö%ús   Â	I7É7
J