
    Whe                       U d dl mZ d dlmZmZmZmZmZ d dlZ	d dl
mZmZmZmZmZmZmZmZmZmZmZmZmZmZ d dlmZmZ d dlmZmZ errd dlm Z m!Z!m"Z"m#Z# d dl$m%Z% d d	lm&Z&m'Z' d dl(Z)d dl*Z+d d
l,m-Z-m.Z.m/Z/ d dl0m1Z1m2Z2 d dl3m4Z4 d dlm5Z5m6Z6 d dl7m8Z8 d dl9m:Z: d dl;m<Z<m=Z=m>Z>m?Z?m@Z@mAZAmBZB  e'd      ZCe&d   ZDdeEd<   eZFdeEd<    eGg d      ZH G d d      ZI G d deeIe	jt                  f         ZJ G d deJeeIe	jt                  f         ZK G d deJeeIe	jt                  f         ZL G d d eJeeIe	jt                  f         ZM G d! d"eJeeIe	jt                  f         ZN G d# d$eJeeIe	jt                  f         ZOy)%    )annotations)TYPE_CHECKINGAnyClassVarcastoverloadN)BACKEND_VERSIONSERIES_ACCEPTS_PD_INDEXSERIES_RESPECTS_DTYPEPolarsAnyNamespacePolarsCatNamespacePolarsDateTimeNamespacePolarsListNamespacePolarsStringNamespacePolarsStructNamespacecatch_polars_exceptionextract_args_kwargsextract_nativenarwhals_to_native_dtypenative_to_narwhals_dtype)Implementationrequires)is_numpy_array_1dis_pandas_index)IterableIteratorMappingSequence)
ModuleType)LiteralTypeVar)Self	TypeAliasTypeIs)MethodPolarsDataFramePolarsNamespace)Version_LimitedContext)DType)Series)Into1DArray	IntoDTypeModeKeepStrategyMultiIndexSelectorNonNestedLiteralNumericLiteral_1DArrayT)FTr#   IncludeBreakpoint
Incomplete)M__add____and____floordiv__
__invert____iter____mod____mul____or____pow____radd____rand____rfloordiv____rmod____rmul____ror____rsub____rtruediv____sub____truediv__absallanyarg_maxarg_minarg_trueclipcountcum_maxcum_mincum_prodcum_sumdiff
drop_nullsexp	fill_nullfill_nanfiltergather_everyhead
is_betweenis_closeis_duplicatedis_empty	is_finiteis_first_distinctis_inis_last_distinctis_null	is_sorted	is_uniqueitemkurtosislenlogmaxmeanminmoden_unique
null_countquantilerankroundsampleshiftskewsqrtstdsumtailto_arrowto_frameto_list	to_pandasuniquevarzip_withc                     e Zd ZU ej                  Zded<   ded<   ded<   ddgdgd	Zd
ed<   ddZe	dd       Z
ddZddZddZddZddZeddd	 	 	 	 	 	 	 	 	 dd       Zedd       Zedd       Zedd       ZddZddZedd       Zedd       Zedd       Z	 	 	 	 ddZdd Zdd!Ze	dd"       Ze	dd#       Ze	dd$       Zdd%Zdd'Z dd(Z! e"jF                  d)      	 	 	 	 	 	 	 	 dd*       Z$ddd+dd,Z%dd-Z&dd.Z'dd/Z(dd0Z)dd1Z*dd2Z+dd3Z,dd4Z-dd5Z.dd6Z/dd7Z0	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 dd8Z1 e"jF                  d)      	 	 	 	 	 	 	 	 	 	 dd9       Z2 e"jF                  d)      	 	 	 	 	 	 	 	 	 	 dd:       Z3dd;Z4dd<Z5dd=Z6dd>Z7	 	 	 	 	 	 	 	 	 	 dd?Z8dd@Z9ddAZ:	 	 	 	 	 	 	 	 	 	 ddBZ;ddCZ<	 	 	 	 	 	 ddDZ=	 	 	 	 	 	 ddEZ>ddFZ?	 	 	 	 	 	 	 	 ddGZ@ddHZAe	ddI       ZBe	ddJ       ZCe	ddK       ZDe	ddL       ZEdMedN<   dMedO<   dMedP<   dMedQ<   dRedS<   dMedT<   dMedU<   dMedV<   dMedW<   dMedX<   dMedY<   dMedZ<   dMed[<   dMed\<   dMed]<   dMed^<   dMed_<   dMed`<   dMeda<   dMedb<   dcedd<   dcede<   dfedg<   dfedh<   dMedi<   dMedj<   dfed<   dMedk<   dMedl<   dMedm<   dMedn<   dMedo<   dMedp<   dMedq<   dMedr<   dMeds<   dMedt<   dMedu<   dMedv<   dMedw<   dMedx<   dcedy<   dMedz<   dMed{<   dMed|<   dMed}<   dMed~<   dced<   dMed<   ded&<   ded<   dfed<   dMed<   ded<   ded<   ded<   dfed<   dfed<   ded<   dMed<   dMed<   dMed<   dMed<   ded<   dMed<   ded<   ded<   dMed<   ded<   ded<   ded<   ded<   dMed<   ded<   dMed<   e	dd       ZFy)PolarsSeriesr   _implementation	pl.Series_native_seriesr)   _version
breakpointrQ   )TFz3ClassVar[Mapping[IncludeBreakpoint, Sequence[str]]]_HIST_EMPTY_SCHEMAc                    || _         || _        y N)r   r   )selfseriesversions      Q/var/www/html/jupyter_env/lib/python3.12/site-packages/narwhals/_polars/series.py__init__zPolarsSeries.__init__   s    $    c                6    | j                   j                         S r   )r   _backend_versionr   s    r   r   zPolarsSeries._backend_version   s    ##4466r   c                     y)Nr    r   s    r   __repr__zPolarsSeries.__repr__   s    r   c                4    ddl m}  || j                        S )Nr   r'   r   )narwhals._polars.namespacer(   r   )r   r(   s     r   __narwhals_namespace__z#PolarsSeries.__narwhals_namespace__   s    >t}}55r   c                    | S r   r   r   s    r   __narwhals_series__z PolarsSeries.__narwhals_series__   s    r   c                    | j                   t        j                  u r| j                   j                         S dt	        | j                          }t        |      )NzExpected polars, got: )r   r   POLARSto_native_namespacetypeAssertionError)r   msgs     r   __native_namespace__z!PolarsSeries.__native_namespace__   sN    >#8#88'';;==&tD,@,@'A&BCS!!r   c                <    | j                  | j                  |      S Nr   )	__class__native)r   r   s     r   _with_versionzPolarsSeries._with_version   s    ~~dkk7~;;r    N)namedtypec               6   |j                   }|rt        ||      nd }|}t        rt        j                  |||      }nJt
        st        |      r|j                         }t        j                  ||      }|r|j                  |      }| j                  ||      S )Nr   context)
r   r   r   plr,   r
   r   	to_seriesr   from_native)	clsdatar   r   r   r   dtype_plvaluesr   s	            r   from_iterablezPolarsSeries.from_iterable   s     ""?D+E7;$! YYtV8<F+1H))+YYtV,FX.vw77r   c                6    t        | t        j                        S r   )
isinstancer   r,   )objs    r   
_is_nativezPolarsSeries._is_native   s    #ryy))r   c              *     | ||j                         S r   )r   )r   r   r   s      r   r   zPolarsSeries.from_native   s    4!1!122r   c              n    t        j                  t        |      r|n|g      }| j                  ||      S )Nr   )r   r,   r   r   )r   r   r   r   s       r   
from_numpyzPolarsSeries.from_numpy   s/    #4T#:4Gvw77r   c                <    | j                   j                  | d      S )Nfull)level)r   r   r   s    r   to_narwhalszPolarsSeries.to_narwhals   s    }}##D#77r   c                <    | j                  || j                        S r   )r   r   r   r   s     r   _with_nativezPolarsSeries._with_native   s    ~~fdmm~<<r   c                     y r   r   r   s     r   _from_native_objectz PolarsSeries._from_native_object   s    >Ar   c                     y r   r   r   s     r   r   z PolarsSeries._from_native_object   s    LOr   c                     y r   r   r   s     r   r   z PolarsSeries._from_native_object   s    36r   c                    | j                  |      r| j                  |      S t        |t        j                        rddlm}  |j                  ||       S |S )Nr   r&   r   )r   r   r   r   	DataFramenarwhals._polars.dataframer&   r   )r   r   r&   s      r   r   z PolarsSeries._from_native_object   sL     ??6"$$V,,fbll+B.?..vtDDr   c                v     t         vr' j                  j                   d d}t        |      d fd}|S )Nz has not attribute 'z'.c                 x    t        | |      \  }}j                   t        j                        |i |      S r   )r   r   getattrr   )argskwargsposkwdsattrr   s       r   funcz&PolarsSeries.__getattr__.<locals>.func   s<    +D&9IC++,FGDKK,F,Tt,TUUr   )r   r   r   r   returnr   )INHERITED_METHODSr   __name__AttributeError)r   r   r   r   s   ``  r   __getattr__zPolarsSeries.__getattr__   sB    ((^^,,--A$rJC %%	V r   c                ,    t        | j                        S r   )rk   r   r   s    r   __len__zPolarsSeries.__len__   s    4;;r   c                .    | j                   j                  S r   )r   r   r   s    r   r   zPolarsSeries.name   s    {{r   c                V    t        | j                  j                  | j                        S r   )r   r   r   r   r   s    r   r   zPolarsSeries.dtype  s    '(9(94==IIr   c                    | j                   S r   )r   r   s    r   r   zPolarsSeries.native  s    """r   c                V    | j                  | j                  j                  |            S r   )r   r   alias)r   r   s     r   r   zPolarsSeries.alias
  s"    ''(9(9$(?@@r   ri   c                    t        |t              r4| j                  | j                  j	                  |j                              S | j                  | j                  j	                  |            S r   )r   r   r   r   __getitem__)r   ri   s     r   r   zPolarsSeries.__getitem__  sP    dL)++DKK,C,CDKK,PQQ''(?(?(EFFr   c                    t        || j                        }| j                  | j                  j	                  |            S r   )r   r   r   r   r   )r   r   r   s      r   r   zPolarsSeries.cast  s2    +E4==A  !1!1(!;<<r      c                   | j                   }|rt        || j                        nd }| j                  |j	                  |||            S )N)return_dtype)r   r   r   r   replace_strict)r   oldnewr   serr   s         r   r   zPolarsSeries.replace_strict  sO     kk  %\4==A 	
   !3!3C5!3!QRRr   copyc               (    | j                  ||      S )Nr   )	__array__r   r   r   s      r   to_numpyzPolarsSeries.to_numpy&  s    ~~e$~//r   c                   | j                   dk  r| j                  j                  |      S | j                  j                  ||      S )N)r         r   )r   r   )r   r   r   r   s      r   r   zPolarsSeries.__array__)  sB      ;.;;((u(55{{$$5t$<<r   c                h    | j                  | j                  j                  t        |                  S r   )r   r   __eq__r   r   others     r   r   zPolarsSeries.__eq__.  '      !3!3N54I!JKKr   c                h    | j                  | j                  j                  t        |                  S r   )r   r   __ne__r   r   s     r   r   zPolarsSeries.__ne__1  r   r   c                h    | j                  | j                  j                  t        |                  S r   )r   r   __ge__r   r   s     r   r  zPolarsSeries.__ge__5  r   r   c                h    | j                  | j                  j                  t        |                  S r   )r   r   __gt__r   r   s     r   r  zPolarsSeries.__gt__8  r   r   c                h    | j                  | j                  j                  t        |                  S r   )r   r   __le__r   r   s     r   r  zPolarsSeries.__le__;  r   r   c                h    | j                  | j                  j                  t        |                  S r   )r   r   __lt__r   r   s     r   r  zPolarsSeries.__lt__>  r   r   c                    | j                   j                  t        |            }| j                  dk  r|j	                  | j
                        }| j                  |      S )N)r      r   )r   __rpow__r   r   r   r   r   )r   r   results      r   r  zPolarsSeries.__rpow__A  sL    %%nU&;<  :-\\$)),F  ((r   c                   	 | j                   j                         }| j                  dk  rmt        j                  | j                   j                               j                  |      }| j                  t        j                  |      | j                           S | j                  |      S # t        $ r}t        |      d d }~ww xY w)N)r      )r   is_nan	Exceptionr   r   r   whenis_not_nullthenr   selectr   )r   native_is_naner  s       r   r  zPolarsSeries.is_nanH  s    	6 KK..0M   7*WWT[[4467<<]KF$$RYYv%6tyy%ABB  //  	6(+5	6s   B) )	C2B>>Cc                    ddl m} | j                  j                         s
d} ||      | j                  j                         S )Nr   )InvalidOperationErrorz<`median` operation not supported for non-numeric input type.)narwhals.exceptionsr  r   
is_numericr   median)r   r  r   s      r   r  zPolarsSeries.medianR  s8    =zz$$&PC',,{{!!##r   c               
   ddl m} | j                  dk  r~| j                  j	                         j                         }| j                  j                  |      }|j                  }|r|j                  t        |            }|j                  |      }n| j                  j                  ||      }|j                  t        j                         j                  t        j                              } |j                   ||       S )Nr   r   )r   r      )	separator)r  
drop_firstr   )r   r&   r   r   rf   rL   
to_dummiescolumnspopintr  with_columnsr   rK   r   Int8r   )r   r  r  r&   	has_nullsr  output_columns_s           r   r   zPolarsSeries.to_dummies[  s    >  ;.++-113I[[++i+@F#^^N"&&s9~6]]>2F[[++iJ+WF$$RVVX]]277%;<***64@@r   c          
        | j                   dk  rd|ind|i} | j                  j                  d||||||d|}	| j                   dk  r| j                  t	        j
                  t	        j                  | j                  j                                j                  |	      j                  d             | j                  j                           S | j                  |	      S )Nr      r   min_periodsmin_samples)comspan	half_lifealphaadjustignore_nullsr   r   )r   r   ewm_meanr   r   r  r  rf   r  	otherwiser   )
r   r.  r/  r0  r1  r2  r-  r3  extra_kwargsnative_results
             r   r4  zPolarsSeries.ewm_meank  s     $$z1 K(- 	 -,, 
%
 
   4'$$		GGT[[0022388GQQRVW++""$    //r   c          	         | j                   dk  rd|ind|i}| j                   | j                  j                  d|||d|      S Nr*  r,  r-  )window_sizecenterddofr   )r   r   r   rolling_varr   r:  r-  r;  r<  r6  s         r   r=  zPolarsSeries.rolling_var  f     $$z1 K(- 	
   #DKK## 'TEQ
 	
r   c          	         | j                   dk  rd|ind|i}| j                   | j                  j                  d|||d|      S r9  )r   r   r   rolling_stdr>  s         r   rA  zPolarsSeries.rolling_std  r?  r   c                   | j                   dk  rd|ind|i}| j                   | j                  j                  d||d|      S Nr*  r,  r-  )r:  r;  r   )r   r   r   rolling_sumr   r:  r-  r;  r6  s        r   rD  zPolarsSeries.rolling_sum  sd     $$z1 K(- 	
   #DKK## ':F
 	
r   c                   | j                   dk  rd|ind|i}| j                   | j                  j                  d||d|      S rC  )r   r   r   rolling_meanrE  s        r   rG  zPolarsSeries.rolling_mean  sd     $$z1 K(- 	
   $DKK$$ ':F
 	
r   c               F   | j                   dk  re| j                  j                  |      }|rd|j                         }t	        j
                  |j                  |       |j                  |      g      }n| j                  j                  ||      }| j                  |      S )N)r   r      )
descending)rJ  
nulls_last)r   r   sortrf   r   concatr[   r   )r   rJ  rK  r  rf   s        r   rL  zPolarsSeries.sort  s      :-[[%%%<F ..*FMM7($;V]]7=S#TU[[%%
%SF  ((r   c                    | j                   j                         j                  |t        |            }| j	                  |      S r   )r   clonescatterr   r   )r   indicesr   ss       r   rP  zPolarsSeries.scatter  s7    KK''1GH  ##r   c                   ddl m} | j                  dk  r|xs |rdnd} | j                  j	                  ||      j
                  d	i | j                  j                  t        j                  | j                  j                        ||r+t        j                  d      t        j                  d      z  nt        j                  d      i}n| j                  j	                  ||||      } |j                  ||       S )
Nr   r   )r   r   r   
proportionrQ   )rL  parallel)rL  rU  r   	normalizer   r   )r   r&   r   r   value_countsr  r   r   colr{   r   )r   rL  rU  r   rV  r&   value_name_r  s           r   rW  zPolarsSeries.value_counts  s     	?  9,J9<'KRT[[--4(-KRR [[%%t{{/?/?(@  "$266'?!B	F [[--H49 . F +**64@@r   c               X    | j                  | j                  j                  |            S )N)reverse)r   r   	cum_count)r   r[  s     r   r\  zPolarsSeries.cum_count  s%      !6!6w!6!GHHr   c                t    	 | j                   j                  |      S # t        $ r}t        |      d d }~ww xY wr   )r   __contains__r  r   )r   r   r  s      r   r^  zPolarsSeries.__contains__  s9    	6;;++E22 	6(+5	6s    	727c                  | j                   dk  r| j                  }| j                         }t        |t              r|j                  |j                  d       n|}|j                  |      j                  ||||      }| j                         j                  |      j                  |      S t        |t              r|j                  n|}	| j                  j                  |	|||      }
| j                  |
      S )N)r       r   )abs_tolrel_tol
nans_equal)r   r   r   r   r   litr   rX  r_   r~   r  
get_columnr   )r   r   ra  rb  rc  r   ns
other_exprexprother_seriesr  s              r   r_   zPolarsSeries.is_close  s       :-99D,,.B.8.Mu||T*SX  66$<((GW ) D ==?))$/::4@@'1%'Fu||E%%'7z & 
   ((r   c                   | j                   j                         }| j                  |dk(  r|j                  d            S |      S )NrL   r   )r   rp   r   r]   )r   keepr  s      r   rp   zPolarsSeries.mode  s;    !!#  45=QMMfMMr   c               Z   t        |      dk  r$t        j                  | j                  |         }n| j                  j                         r|rZt        j                  |dd        j                  d      j                  t        j                  dt        j                              }nYt        j                  t        j                  t        |      dz
  t        j                              }n| j                  |d |      S | j                         j                  j!                  ||       S )Nr   schemar   r   rQ   bins	bin_countinclude_breakpointr   )rk   r   r   r   r   ra   r,   r~   r$  rd  Int64r  zeros_hist_from_datar   
_dataframer   )r   rq  rs  r   s       r   hist_from_binszPolarsSeries.hist_from_bins  s     t9>\\)@)@AS)TUF[[!!#!IId12h'Xl+!\q"(((;\<  #d)a-)JK''T>P (   **,77CCFTXCYYr   c               h   |dk(  r$t        j                  | j                  |         }n| j                  j	                         r|rTt        j
                  t        j                  d|dz         |z  t        j                  dt         j                              }not        j
                  t        j                  |t         j                              }n6t        dk  rd }| j                  |      }n|}d }| j                  |||      S | j                         j                  j                  || 	      S )
Nr   rm  r   )r   rQ   ro  r   r  )rr  rp  r   )r   r   r   r   ra   r  	int_rangerd  rt  ru  r	   _bins_from_bin_countrv  r   rw  r   )r   rr  rs  r   rQ   rq  s         r   hist_from_bin_countz PolarsSeries.hist_from_bin_count#  s    >\\)@)@AS)TUF[[!!#!!||Ay1}=	I&&BHH-
 )RXX)FG (0090E!''#5 (  
 **,77CCFTXCYYr   c                   t        d| j                  j                               }t        d| j                  j                               }||k(  r
|dz  }|dz  }||z
  |z  }t	        j
                  d|dz   d      |z  |z   S )a>  Prepare bins based on backend version compatibility.

        polars <1.15 does not adjust the bins when they have equivalent min/max
        polars <1.5 with bin_count=...
        returns bins that range from -inf to +inf and has bin_count + 1 bins.
          for compat: convert `bin_count=` call to `bins=`
        floatg      ?r   r   T)eager)r   r   ro   rm   r   r{  )r   rr  lowerupperwidths        r   r|  z!PolarsSeries._bins_from_bin_count?  sz     Wdkkoo/0Wdkkoo/0E>SLESLE)+||Ay1}D9EAEIIr   c                  ddl m} | j                  }t        dk  s||j	                  d      }|j                  ||d|      }|sC|j                  d   }|j                  t        j                  |      j                  d            }nt        dk  r|j                  d	d
i      }|t        dk  rEt        j                  dt        |            }|j                  |dkD  |t        |      dz
  k  z        }t        dk  r||j                  dd      j!                  t        j                  d      t        j"                  |      |d   k(  j%                         z         j'                  |j                  d            } |j(                  ||       S )zbCalculate histogram from non-empty data and post-process the results based on the backend version.r   r   rz  NF)rr  include_categoryrs  rQ   )r   r   break_pointr   )r   rI  r   )r      r   )r   r&   r   r	   rZ   histr!  r  r   rX  r   renamer{  rk   r[   slicer$  rd  r{   vstackr   )	r   rq  rr  rs  r&   r   dfcol_namers	            r   rv  zPolarsSeries._hist_from_dataQ  sT    	? W$(8__T*F[["1	  
 "zz!}H266(+11':;Bv%M<89B'LLCG,YYA!c"gk/:;(HHQN!\"&&/bffVnQ6O5T5T5V"WXVBHHQK(  +**2t<<r   c                    | j                   S r   )r   r   s    r   	to_polarszPolarsSeries.to_polars}  s    {{r   c                    t        |       S r   )PolarsSeriesDateTimeNamespacer   s    r   dtzPolarsSeries.dt  s    ,T22r   c                    t        |       S r   )PolarsSeriesStringNamespacer   s    r   strzPolarsSeries.str      *400r   c                    t        |       S r   )PolarsSeriesCatNamespacer   s    r   catzPolarsSeries.cat  s    '--r   c                    t        |       S r   )PolarsSeriesStructNamespacer   s    r   structzPolarsSeries.struct  r  r   zMethod[Self]r7   r8   r9   r:   zMethod[Iterator[Any]]r;   r<   r=   r>   r?   r@   rA   rB   rC   rD   rE   rF   rG   rH   rI   rJ   zMethod[bool]rK   rL   zMethod[int]rM   rN   rO   rP   rR   rS   rT   rU   rV   rW   rX   rY   rZ   r[   r\   r]   r^   r`   ra   rb   rc   rd   re   rf   rg   rh   zMethod[Any]zMethod[float | None]rj   rk   rl   rm   zMethod[float]rn   ro   rq   rr   rs   rt   ru   rv   rw   rx   ry   rz   r{   r|   zMethod[pa.Array[Any]]r}   zMethod[PolarsDataFrame]r~   zMethod[list[Any]]r   zMethod[pd.Series[Any]]r   r   r   r   c                    t        |       S r   )PolarsSeriesListNamespacer   s    r   listzPolarsSeries.list  s    (..r   )r   r   r   r)   r   None)r   ztuple[int, ...]r   r  r   r(   )r   r"   )r   r   )r   r)   r   r"   )
r   zIterable[Any]r   r*   r   r  r   IntoDType | Noner   r"   )r   zpl.Series | Anyr   zTypeIs[pl.Series])r   r   r   r*   r   r"   )r   r-   r   r*   r   r"   )r   zSeries[pl.Series])r   r   r   r"   )r   zpl.DataFramer   r&   )r   r4   r   r4   )r   zpl.Series | pl.DataFrame | Tr   zSelf | PolarsDataFrame | T)r   r  r   r   )r   r#  )r   r+   r   r   )r   r  r   r"   )ri   zMultiIndexSelector[Self]r   z
Any | Self)r   r.   r   r"   )r   z!Sequence[Any] | Mapping[Any, Any]r   zSequence[Any]r   r  r   r"   r   )r   r   r   zbool | Noner   r3   )r   objectr   r"   )r   r"   r   r"   )r   zPolarsSeries | Anyr   r"   )r   r   )r  r  r  boolr   r&   )r.  float | Noner/  r  r0  r  r1  r  r2  r  r-  r#  r3  r  r   r"   )
r:  r#  r-  r#  r;  r  r<  r#  r   r"   )r:  r#  r-  r#  r;  r  r   r"   )rJ  r  rK  r  r   r"   )rQ  zint | Sequence[int]r   r   r   r"   )
rL  r  rU  r  r   z
str | NonerV  r  r   r&   )r[  r  r   r"   )r   r   r   r  )
r   zSelf | NumericLiteralra  r  rb  r  rc  r  r   r   )rk  r/   r   r"   )rq  zlist[float]rs  r  r   r&   )rr  r#  rs  r  r   r&   )rr  r#  r   r   )rq  zlist[float] | Nonerr  z
int | Noners  r  r   r&   )r   r  )r   r  )r   r  )r   r  )r   r  )Gr   
__module____qualname__r   r   r   __annotations__r   r   propertyr   r   r   r   r   r   classmethodr   staticmethodr   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   backend_versionr   r   r   r   r   r  r  r  r  r  r  r  r   r4  r=  rA  rD  rG  rL  rP  rW  r\  r^  r_   rp   rx  r}  r|  rv  r  r  r  r  r  r  r   r   r   r   r      sA   &4&;&;O^; W%yOK 
  7 76
"<  "&88 !	8
 8  8 
8 8* * * 3 3 8 88= A AO O6 6
2
	#
	      J J # #AG
= Xd#S.S S
 'S 
S $S0 0=
LLLLLL)0$A !0 !0 	!0
  !0 !0 !0 !0 !0 
!0F Xd#

03
=A
IL
	
 $
 Xd#

03
=A
IL
	
 $





)$AA'+A3=AJNA	A,I6)$) 	)
 ) ) 
)0NZZ8<Z	Z(ZZ59Z	Z8J$*=&*=3=*=VZ*=	*=X 3 3 1 1 . . 1 1 ##			

	
##""
""			
	


		
##%%%%	/ /r   r   c                  Z    e Zd ZddZed	d       Zed
d       Zedd       ZddZddZ	y)PolarsSeriesNamespacec                    || _         y r   _seriesr   s     r   r   zPolarsSeriesNamespace.__init__  s	    r   c                    | j                   S r   r  r   s    r   	compliantzPolarsSeriesNamespace.compliant  s    ||r   c                .    | j                   j                  S r   )r  r   r   s    r   r   zPolarsSeriesNamespace.native  s    ||"""r   c                .    | j                   j                  S r   )r  r   r   s    r   r   zPolarsSeriesNamespace.name  s    ~~"""r   c                6    | j                   j                         S r   )r  r   r   s    r   r   z,PolarsSeriesNamespace.__narwhals_namespace__  s    ~~4466r   c                6    | j                   j                         S r   )r  r~   r   s    r   r~   zPolarsSeriesNamespace.to_frame  s    ~~&&((r   N)r   r   r   r  r   r   r  r  r  )r   r&   )
r   r  r  r   r  r  r   r   r   r~   r   r   r   r  r    sM       # # # #7)r   r  c                      e Zd Zy)r  Nr   r  r  r   r   r   r  r        r   r  c                      e Zd ZddZy)r  c                    | j                   }| j                         }| j                         j                  |j	                  |      j
                  j                  |            j                  |      S r   )r   r   r~   r  rX  r  zfillre  )r   r  r   rf  s       r   r  z!PolarsSeriesStringNamespace.zfill   sU    yy((*}}%%bffTl&6&6&<&<U&CDOOPTUUr   N)r  r#  r   r   )r   r  r  r  r   r   r   r  r    s    Vr   r  c                      e Zd Zy)r  Nr  r   r   r   r  r    r  r   r  c                      e Zd ZddZddZy)r  c                    | j                   }| j                         }| j                         j                  |j	                  |      j
                  j                               j                  |      S r   )r   r   r~   r  rX  r  rk   re  )r   r   rf  s      r   rk   zPolarsSeriesListNamespace.len  sR    yy((*}}%%bffTl&7&7&;&;&=>II$OOr   c                    | j                   }| j                         }| j                         j                  |j	                  |      j
                  j                  |            j                  |      S r   )r   r   r~   r  rX  r  containsre  )r   ri   r   rf  s       r   r  z"PolarsSeriesListNamespace.contains  sU    yy((*}}%%bffTl&7&7&@&@&FGRRSWXXr   Nr  )ri   r1   r   r   )r   r  r  rk   r  r   r   r   r  r    s    P
Yr   r  c                      e Zd Zy)r  Nr  r   r   r   r  r    r  r   r  )P
__future__r   typingr   r   r   r   r   polarsr   narwhals._polars.utilsr	   r
   r   r   r   r   r   r   r   r   r   r   r   r   narwhals._utilsr   r   narwhals.dependenciesr   r   collections.abcr   r   r   r   typesr   r    r!   pandaspdpyarrowpatyping_extensionsr"   r#   r$   r   r%   r&   r   r(   r)   r*   narwhals.dtypesr+   narwhals.seriesr,   narwhals.typingr-   r.   r/   r0   r1   r2   r3   r4   r5   r  r6   	frozensetr   r   r  r  r  r  r  r  r   r   r   <module>r     sb   " ? ?      5 DEE '99B:8%&   	A#*;#7y7
I  NP fS	/ S	/l).|RYY/FG ).2<3JK
V0ryy1HIV-lBII.EF
Y.|RYY/FGY0ryy1HIr   