
    Lpj                       % S SK Jr  S SKJr  S SKJrJrJrJrJ	r	J
r
  S SKrS SKJrJr  S SKJr  S SKJrJr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 J!r!J"r"J#r#J$r$J%r%  S S
K&J'r(J)r*  S SK+J,r,J-r-  S SK.J/r0  S SK1J2r2J3r3J4r4  S SK5J6r7  S SK8J9r:  S SK;J<r<J=r=J>r>  S SK?J@r@JArAJBrBJCrCJDrDJErEJFrFJGrGJHrHJIrIJJrJJKrKJLrLJMrMJNrNJOrOJPrPJQrQJRrRJSrSJTrTJUrUJVrVJWrWJXrXJYrYJZrZJ[r[J\r\  S SK]J^r^J_r_J`r`JaraJbrbJcrcJdrdJere  S SKfJgrgJhrhJiri  \(       a  S SKjJkrkJlrlJmrmJnrn  S SKoJprp  S SKqJrrrJsrsJtrt  S SKJuru  S SKvJwrxJyrzJ{r|J}r~JrJrJrJrJrJrJrJrJrJrJr  S SKJrJrJrJrJrJrJrJr  S SK&JrJr  S SKJrJrJrJrJrJrJrJrJrJr  \" S\S9r\r" S5      r\" S5      r " S  S!\(\_   5      r' " S" S#\*\a   5      r) " S$ S%\:\c   5      r9 " S& S'\05      r/ " S( S)\75      r6\
SS* j5       r\
SS+ j5       r\
SS, j5       r\
SS- j5       r    SS. jr\
SS/ j5       r\
SS0 j5       r\
SS1 j5       r\
SS2 j5       r\
      SS3 j5       r\
      SS4 j5       r\
SS5 j5       r\
      SS6 j5       r\
      SS7 j5       r\
      SS8 j5       r\
      SS9 j5       r\
      SS: j5       r\
      SS; j5       r\
      SS< j5       r\
      SS= j5       r\
      SS> j5       r\
      SS? j5       r\
      SS@ j5       r\
      SSA j5       r\
      SSB j5       r\
SSC j5       r\
SSD j5       r\
SESF.             SSG jj5       rSSSESESESSH.                 SSI jjr\
SJSK.     SSL jj5       r\
SJSK.     SSM jj5       r\
SJSK.     SSN jj5       r\
SSO j5       r\
SJSP.     SSQ jj5       r\
SJSP.     SSR jj5       r\
SJSP.     SSS jj5       r\
SST j5       rSSSU.       SSV jjr SSSSESESESWSH.               SSX jjjrSSY jrSSZ jrSS[ jrSS\ jrSS] jrSSS^ jjrSS_ jrSS` jrSSa jrSSb jrSSc jrSSd jrSESe.     SSf jjrSESe.     SSg jjrSSh jrSSi jrSSj jr S       SSk jjrSlSm.SSn jjrSoSESp.         SSq jjrSSr jrSSs jr    SSt jr " Su Sv\GR                  5      r " Sw Sx\GR                  \/5      rSSy jr\" SWSz9 SSSS{.           SS| jjj5       r\" SWSz9SSS{.       SS} jj5       r\" 5        SSSS{.         SS~ jjj5       r\'GR                  rS\S'   \" SWSz9 SSSS{.         SS jjj5       r\" SWSz9SSS{.         SS jj5       r\" SWSz9SSS{.         SS jj5       r\" SWSz9SSS{.         SS jj5       r\" SWSz9SSS{.         SS jj5       rSS jr/ SQrg)    )annotationswraps)TYPE_CHECKINGAnyFinalLiteralcastoverloadN)
exceptions	functions)issue_warning)ExprKindExprNodeis_expr)TypeVarassert_never)ImplementationVersiondeprecate_native_namespacegenerate_temporary_column_nameinherit_docis_ordered_categoricalmaybe_align_indexmaybe_convert_dtypesmaybe_get_indexmaybe_reset_indexmaybe_set_indexvalidate_strict_and_pass_though)	DataFrame	LazyFrame)InvalidIntoExprErrorNarwhalsUnstableWarning)Expr)_new_series_implconcatshow_versions)Schema)Series)dependenciesdtypes	selectors)ArrayBinaryBooleanCategoricalDateDatetimeDecimalDurationEnumFieldFloat16Float32Float64Int8Int16Int32Int64Int128ListObjectStringStructTimeUInt8UInt16UInt32UInt64UInt128Unknown)
DataFrameTIntoDataFrameT	IntoFrameIntoLazyFrameT
IntoSeriesIntoSeriesT
LazyFrameTSeriesT)_from_native_implget_native_namespaceto_py_scalar)CallableIterableMappingSequence)
ModuleType)	ParamSpecSelfUnpack)ExprMetadata)AllowAnyStrictV1
AllowAnyV1AllowLazyStrictV1AllowLazyV1AllowSeriesStrictV1AllowSeriesV1ExcludeSeriesStrictV1ExcludeSeriesV1IntoArrowTableOnlyEagerOrInterchangeOnlyEagerOrInterchangeStrictOnlySeriesStrictV1OnlySeriesV1PassThroughUnknownV1StrictUnknownV1)ArrowBackendEagerAllowedIntoBackendLazyAllowedPandas
PluginNamePolars)MultiColSelectorMultiIndexSelector)

FileSource	IntoDTypeIntoExpr
IntoSchemaNonNestedLiteralPythonLiteralSingleColSelectorSingleIndexSelector_1DArray_2DArrayT)defaultPRc                  p  ^  \ rS rSr\R
                  r\" \5      SU 4S jj5       r	\
      SU 4S jj5       r\
 SSS.       S U 4S jjjj5       r\
 S       S!U 4S jjj5       r\
 S       S"U 4S jjj5       r\S#S	 j5       r\S$S
 j5       r\S%S j5       r\    S&S j5       r\    S'S j5       r    S(U 4S jjrS)U 4S jjr SSS.     S*U 4S jjjjr\SS.S+S jj5       r\S,S j5       r\SS.   S-S jj5       rSS.   S-U 4S jjjrS.U 4S jjrS.U 4S jjrS/S jrSrU =r$ )0r       c               ^   > UR                   [        R                  L d   e[        TU ]  XS9  g N)level_versionr   V1super__init__selfdfr   	__class__s      W/var/www/html/pdf-tiff/venv/lib/python3.13/site-packages/narwhals/stable/v1/__init__.pyr   DataFrame.__init__   )    {{gjj((()    c               6   > [         TU ]  XS9n[        SU5      $ NbackendDataFrame[Any])r   
from_arrowr
   )clsnative_framer   resultr   s       r   r   DataFrame.from_arrow   s%     #L#B$f--r   Nr   c               8   > [         TU ]  XUS9n[        SU5      $ r   )r   	from_dictr
   r   dataschemar   r   r   s        r   r   DataFrame.from_dict   s'     "4"A$f--r   c               8   > [         TU ]  XUS9n[        SU5      $ r   )r   
from_dictsr
   r   s        r   r   DataFrame.from_dicts   '     #D'#B$f--r   c               8   > [         TU ]  XUS9n[        SU5      $ r   r   
from_numpyr
   r   s        r   r   DataFrame.from_numpy   r   r   c                "    [        S[        5      $ )Ntype[Series[Any]])r
   r)   r   s    r   _seriesDataFrame._series   s    '00r   c                "    [        S[        5      $ )Ntype[LazyFrame[Any]])r
   r!   r   s    r   
_lazyframeDataFrame._lazyframe   s    *I66r   c                    g N r   items     r   __getitem__DataFrame.__getitem__       WZr   c                    g r   r   r   s     r   r   r      s     r   c                    g r   r   r   s     r   r   r      s     r   c                "   > [         TU ]  U5      $ r   )r   r   )r   r   r   s     r   r   r      s     w"4((r   c                "   > [         TU ]  U5      $ r   )r   
get_column)r   namer   s     r   r   DataFrame.get_column   s     w!$''r   )sessionc               0   > [        [        TU ]	  XS95      $ )N)r   r   )
_stableifyr   lazy)r   r   r   r   s      r   r   DataFrame.lazy   s     %',w,HIIr   .	as_seriesc                   g r   r   r   r   s     r   to_dictDataFrame.to_dict   s    TWr   c                   g r   r   r   s     r   r   r      s    MPr   Tc                   g r   r   r   s     r   r   r      s     9<r   c                  > [         TU ]  US9$ )Nr   )r   r   )r   r   r   s     r   r   r      s    
 w33r   c                2   > [        [        TU ]	  5       5      $ r   )r   r   is_duplicatedr   r   s    r   r   DataFrame.is_duplicated   s    %'/122r   c                2   > [        [        TU ]	  5       5      $ r   )r   r   	is_uniquer   s    r   r   DataFrame.is_unique   s    %'+-..r   c                P    U R                  [        5       R                  5       5      $ r   selectall_l1_normr   s    r   r   DataFrame._l1_norm      {{35>>+,,r   r   r   r   r   &Literal['full', 'lazy', 'interchange']returnNone)r   rf   r   &IntoBackend[EagerAllowed | PluginName]r   r   r   )r   Mapping[str, Any]r   2IntoSchema | Mapping[str, IntoDType | None] | Noner   -IntoBackend[EagerAllowed | PluginName] | Noner   r   )r   zSequence[Any]r   r   r   r   r   r   )r   r   r   !IntoSchema | Sequence[str] | Noner   r   r   r   )r   r   )r   r   )r   z-tuple[SingleIndexSelector, SingleColSelector]r   r   )r   z2str | tuple[MultiIndexSelector, SingleColSelector]r   Series[Any])r   zSingleIndexSelector | MultiIndexSelector | MultiColSelector | tuple[SingleIndexSelector, MultiColSelector] | tuple[MultiIndexSelector, MultiColSelector]r   r[   )r   a  SingleIndexSelector | SingleColSelector | MultiColSelector | MultiIndexSelector | tuple[SingleIndexSelector, SingleColSelector] | tuple[SingleIndexSelector, MultiColSelector] | tuple[MultiIndexSelector, SingleColSelector] | tuple[MultiIndexSelector, MultiColSelector]r   zSeries[Any] | Self | Any)r   strr   r)   )r   zIntoBackend[LazyAllowed] | Noner   z
Any | Noner   LazyFrame[Any])r   zLiteral[True]r   zdict[str, Series[Any]])r   zLiteral[False]r   zdict[str, list[Any]])r   boolr   z-dict[str, Series[Any]] | dict[str, list[Any]])r   r   r   r[   )__name__
__module____qualname____firstlineno__r   r   r   r   NwDataFramer   classmethodr   r   r   r   propertyr   r   r   r   r   r   r   r   r   r   __static_attributes____classcell__r   s   @r   r    r       s{   zzH* * .$. 8	.
 
. .  FJ.
 BF.. C.
 ?. 
. . .  FJ.. C.
 8. 
. .  59.. 2.
 8. 
. . 1 1 7 7 Z ZF	  	:	 
	 	):) 
")( 48J #	J0J 	J
 
J J 47W WP P#'< <	6< < $(4 4	64 43/- -r   r    c                     ^  \ rS rSr\R
                  r\" \5      SU 4S jj5       r	\
SS j5       rSS jr S     SU 4S jjjrSS jrSSU 4S jjjrSSS	 jjr SSS
.     SS jjjrSrU =r$ )r!   i  c               ^   > UR                   [        R                  L d   e[        TU ]  XS9  g r   r   r   s      r   r   LazyFrame.__init__  r   r   c                    [         $ r   r    r   s    r   
_dataframeLazyFrame._dataframe      r   c                    g r   r   )r   metadatas     r   _validate_metadataLazyFrame._validate_metadata  s    r   Nc                :   > [        [        TU ]  " SSU0UD65      $ )Nr   r   )r   r   collect)r   r   kwargsr   s      r   r  LazyFrame.collect  s!     %'/D'DVDEEr   c                P    U R                  [        5       R                  5       5      $ r   r   r   s    r   r   LazyFrame._l1_norm  r   r   c                "   > [         TU ]  U5      $ )Get the last `n` rows.)r   tail)r   nr   s     r   r  LazyFrame.tail!  s    w|Ar   c                R    U R                  U R                  R                  XS95      $ )zTake every nth row in the DataFrame and return as a new DataFrame.

Arguments:
    n: Gather every *n*-th row.
    offset: Starting index.
r  offset)_with_compliant_compliant_framegather_everyr   r  r  s      r   r  LazyFrame.gather_every%  s.     ##!!...B
 	
r   )order_byc                   [        U[        5      (       a  U/OUnU R                  U R                  R	                  UUS95      $ )N)r   r  )
isinstancer   r  r  with_row_index)r   r   r  	order_by_s       r   r  LazyFrame.with_row_index0  sK     #-Xs";";XJ	##!!00" 1 
 	
r   r   r   r   ztype[DataFrame[Any]])r  r]   r   r   r   )r   z+IntoBackend[Polars | Pandas | Arrow] | Noner	  r   r   r   r   )   r  intr   r[   r   r  r#  r  r#  r   r[   )index)r   r   r  zstr | Sequence[str] | Noner   r[   )r   r   r   r   r   r   r   r   NwLazyFramer   r   r   r  r  r   r  r  r  r   r   r   s   @r   r!   r!     s    zzH* *  
 FJFBFUXF	F F
- 	
 "	
MQ	
	
0J	
		
 	
r   r!   c                  d  ^  \ rS rSr\R
                  r\" \5            SU 4S jj5       r	\
 S         SU 4S jjj5       r\
 S         SU 4S jjj5       r\SS j5       rSU 4S jjrSSSSS	.         SU 4S
 jjjr SSSS.       SU 4S jjjjrSS.SU 4S jjjrSrU =r$ )r)   i<  c               ^   > UR                   [        R                  L d   e[        TU ]  XS9  g r   r   )r   seriesr   r   s      r   r   Series.__init__?  s+     '**,,,-r   Nc               8   > [         TU ]  XX4S9n[        SU5      $ Nr   r   r   r   r   valuesdtyper   r   r   s         r   r   Series.from_numpyI  s&     #D%#IM6**r   c               8   > [         TU ]  XX4S9n[        SU5      $ r-  )r   from_iterabler
   r.  s         r   r3  Series.from_iterableU  s&     &tU&LM6**r   c                    [         $ r   r   r   s    r   r   Series._dataframea  r  r   c                2   > [        [        TU ]	  5       5      $ r   )r   r   to_framer   s    r   r8  Series.to_framee  s    %'*,--r   Fsortparallelr   	normalizec          	     2   > [        [        TU ]	  XX4S95      $ )Nr:  )r   r   value_counts)r   r;  r<  r   r=  r   s        r   r?  Series.value_countsh  s)     G 4 ! 
 	
r   T)	bin_countinclude_breakpointc               V   > Sn[        U[        5        [        [        TU ]  XUS95      $ )NzZ`Series.hist` is being called from the stable API although considered an unstable feature.)binsrA  rB  )r   r#   r   r   hist)r   rD  rA  rB  msgr   s        r   rE  Series.histv  s>    # 	 	c23GLCU  
 	
r   ignore_nullsc               B   > Sn[        U[        5        [        TU ]  US9$ )Nz_`Series.any_value` is being called from the stable API although considered an unstable feature.rH  )r   r#   r   	any_value)r   rI  rF  r   s      r   rK  Series.any_value  s-    # 	 	c23w l ;;r   r   )r*  r   r   r   r   r   r   )
r   r   r/  r   r0  IntoDType | Noner   r   r   r   )
r   r   r/  zIterable[Any]r0  rM  r   r   r   r   r   )r   r   )
r;  r   r<  r   r   z
str | Noner=  r   r   r   )rD  zlist[float] | NonerA  
int | NonerB  r   r   r   )rI  r   r   r|   )r   r   r   r   r   r   r   r   NwSeriesr   r   r   r3  r   r   r8  r?  rE  rK  r   r   r   s   @r   r)   r)   <  s   zzH..%K.	. . 
 #'		+	+ 	+  		+ 8	+ 
	+ 	+ 
 #'		+	+ 	+  		+ 8	+ 
	+ 	+  . 
 
 	

 
 
 

 
  $(
 !%#'
 
 	

 !
 

 
$ 16 < < <r   r)   c                     ^  \ rS rSrSU 4S jjrSSS jjrSSS jjrSSS jjrSS.SS jjrS	S	S
.SS jjr	SS jr
SS jrSS jrSS jrSS jr SSS	SS.         SS jjjrS	S.SS jjrSrU =r$ ) r$   i  c                    > [         TU ]  5       $ r   )r   _taxicab_normr   s    r   r   Expr._l1_norm  s    w$&&r   c                R    U R                  [        [        R                  SUS95      $ )zGet the first `n` rows.headr  _append_noder   r   ORDERABLE_FILTRATIONr   r  s     r   rU  	Expr.head  #      (*G*GST!UVVr   c                R    U R                  [        [        R                  SUS95      $ )r  r  rV  rW  rZ  s     r   r  	Expr.tail  r\  r   c           	     R    U R                  [        [        R                  SXS95      $ )zTake every nth value in the Series and return as new Series.

Arguments:
    n: Gather every *n*-th row.
    offset: Starting index.
r  r  rW  r  s      r   r  Expr.gather_every  s)       X22NaW
 	
r   N)maintain_orderc               ~    Ub  Sn[        U[        5        U R                  [        [        R
                  S5      5      $ )z(Return unique values of this expression.zx`maintain_order` has no effect and is only kept around for backwards-compatibility. You can safely remove this argument.unique)r   UserWarningrX  r   r   
FILTRATION)r   ra  rF  s      r   rc  Expr.unique  s<    %7  #{+  (*=*=x!HIIr   F
descending
nulls_lastc          	     R    U R                  [        [        R                  SXS95      $ )z*Sort this column. Place null values first.r;  rg  )rX  r   r   WINDOW)r   rh  ri  s      r   r;  	Expr.sort  s(      J
 	
r   c                T    U R                  [        [        R                  S5      5      $ )z'Returns the index of the maximum value.arg_maxrX  r   r   ORDERABLE_AGGREGATIONr   s    r   rn  Expr.arg_max         (*H*H)!TUUr   c                T    U R                  [        [        R                  S5      5      $ )z'Returns the index of the minimum value.arg_minro  r   s    r   rt  Expr.arg_min  rr  r   c                T    U R                  [        [        R                  S5      5      $ )z/Find elements where boolean expression is True.arg_truerW  r   s    r   rw  Expr.arg_true  s       (*G*G!TUUr   c                T    U R                  [        [        R                  S5      5      $ )zGet the first value.firstro  r   s    r   rz  
Expr.first  s       (*H*H'!RSSr   c                T    U R                  [        [        R                  S5      5      $ )zGet the last value.lastro  r   s    r   r}  	Expr.last  s       (*H*H&!QRRr   )fractionwith_replacementseedc               X    U R                  [        [        R                  SUUUUS95      $ )a}  Sample randomly from this expression.

Arguments:
    n: Number of items to return. Cannot be used with fraction.
    fraction: Fraction of items to return. Cannot be used with n.
    with_replacement: Allow values to be sampled more than once.
    seed: Seed for the random number generator. If set to None (default), a random
        seed is generated for each sample operation.
sample)r  r  r  r  )rX  r   r   re  )r   r  r  r  r  s        r   r  Expr.sample  s7    "   ##!!1	
 		
r   rH  c               v    Sn[        U[        5        U R                  [        [        R
                  SUS95      $ )Nz]`Expr.any_value` is being called from the stable API although considered an unstable feature.rK  rH  )r   r#   rX  r   r   AGGREGATION)r   rI  rF  s      r   rK  Expr.any_value  s>    # 	 	c23  X));\R
 	
r   r   r   )
   r"  r$  r%  )ra  bool | Noner   r[   )rh  r   ri  r   r   r[   r   )
r  rN  r  zfloat | Noner  r   r  rN  r   r[   )rI  r   r   r[   )r   r   r   r   r   rU  r  r  rc  r;  rn  rt  rw  rz  r}  r  rK  r   r   r   s   @r   r$   r$     s    'WW	
 7; J */5 
VVVTS 
 "&!&

 	

 
 
 

8 16 
 
r   r$   c                  ,    \ rS rSr\R
                  rSrg)r(   i  r   N)r   r   r   r   r   r   r   r   r   r   r   r(   r(     s    zzHr   r(   c                    g r   r   objs    r   r   r         ORr   c                    g r   r   r  s    r   r   r     r  r   c                    g r   r   r  s    r   r   r         CFr   c                    g r   r   r  s    r   r   r     s    %(r   c                H   [        U [        5      (       a;  [        U R                  R	                  [
        R                  5      U R                  S9$ [        U [        5      (       a;  [        U R                  R	                  [
        R                  5      U R                  S9$ [        U [        5      (       a;  [        U R                  R	                  [
        R                  5      U R                  S9$ [        U [        5      (       a  [        U R                  6 $ [!        U 5        g r   )r  r   r    r  _with_versionr   r   _levelr'  r!   rO  r)   _compliant_seriesNwExprr$   _nodesr   r  s    r   r   r     s     #{##--;;GJJGszzZZ#{##--;;GJJGszzZZ#x  c++99'**ESZZXX#vSZZ  r   c                    g r   r   native_objectkwdss     r   from_nativer    s    PSr   c                    g r   r   r  s     r   r  r    s    VYr   c                    g r   r   r  s     r   r  r    s    QTr   c                    g r   r   r  s     r   r  r    r   r   c                    g r   r   r  s     r   r  r         r   c                    g r   r   r  s     r   r  r     r  r   c                    g r   r   r  s     r   r  r  $  s    UXr   c                    g r   r   r  s     r   r  r  &  r  r   c                    g r   r   r  s     r   r  r  *       !$r   c                    g r   r   r  s     r   r  r  .  r  r   c                    g r   r   r  s     r   r  r  2  r  r   c                    g r   r   r  s     r   r  r  6  r  r   c                    g r   r   r  s     r   r  r  :       r   c                    g r   r   r  s     r   r  r  >  r  r   c                    g r   r   r  s     r   r  r  B       7:r   c                    g r   r   r  s     r   r  r  F  r  r   c                    g r   r   r  s     r   r  r  J  r  r   c                    g r   r   r  s     r   r  r  N  r  r   c                    g r   r   r  s     r   r  r  R  s	     SVr   c                    g r   r   r  s     r   r  r  V  s	     SVr   c                    g r   r   r  s     r   r  r  [  s    LOr   c                    g r   r   r  s     r   r  r  ]  s    GJr   F)eager_or_interchange_onlyc                   g r   r   )r  pass_through
eager_onlyr  series_onlyallow_seriess         r   r  r  b  s     r   )strictr  r  r  r  r  c          
     6   [        U [        [        45      (       a	  U(       d  U $ [        U [        5      (       a  U(       d  U(       a  U $ [	        XSS9nU(       a#  S[        [        U5      5      < 3n[        U5      e[        U UUUUU[        R                  S9$ )a3  Convert `native_object` to Narwhals Dataframe, Lazyframe, or Series.

See `narwhals.from_native` for full docstring. Note that `native_namespace` is
an is the same as `backend` but only accepts module types - for new code, we
recommend using `backend`, as that's available beyond just `narwhals.stable.v1`.
Fpass_through_defaultz1from_native() got an unexpected keyword argument )r  r  r  r  r  version)r  r    r!   r)   r   nextiter	TypeErrorrR   r   r   )	r  r  r  r  r  r  r  r  rF  s	            r   r  r  n  s    . -)Y!788-((k\25L A$tDzBRAUVn!";!

 r   .)r  c                   g r   r   narwhals_objectr  s     r   	to_nativer         r   c                   g r   r   r  s     r   r  r    r  r   c                   g r   r   r  s     r   r  r         r   c                   g r   r   r  s     r   r  r    s    =@r   r  c                   g r   r   r  r  s     r   r  r        
 r   c                   g r   r   r  s     r   r  r    r  r   c                   g r   r   r  s     r   r  r    r  r   c                   g r   r   r  s     r   r  r    r  r   )r  r  c               D    SSK Jn  U" XSS9n[        R                  " XS9$ )a  Convert Narwhals object to native one.

See `narwhals.to_native` for full docstring. Note that `native_namespace` is
an is the same as `backend` but only accepts module types - for new code, we
recommend using `backend`, as that's available beyond just `narwhals.stable.v1`.
r   r   Fr  r  )narwhals._utilsr   nwr  )r  r  r  r   s       r   r  r    s(     @25L <<CCr   Tc               T   ^^^^^ [        UTSS9mSUUUUU4S jjnU c  U$ U" U 5      $ )a!  Decorate function so it becomes dataframe-agnostic.

See `narwhals.narwhalify` for full docstring. Note that `native_namespace` is
an is the same as `backend` but only accepts module types - for new code, we
recommend using `backend`, as that's available beyond just `narwhals.stable.v1`.
Tr  c                @   >^  [        T 5      SUUUU UU4S jj5       nU$ )Nc                   > U  Vs/ s H  n[        UTTTTTS9PM     nnUR                  5        VVs0 s H  u  pEU[        UTTTTTS9_M     nnn/ UQUR                  5       Q7 Vs1 s H   n[        USS 5      =n(       d  M  U" 5       iM"     n	nU	R	                  5       S:  a  Sn
[        U
5      eT" U0 UD6n[        UTS9$ s  snf s  snnf s  snf )N)r  r  r  r  r  __native_namespace__   z_Found multiple backends. Make sure that all dataframe/series inputs come from the same backend.r  )r  itemsr/  getattr__len__
ValueErrorr  )argsr	  argargs_nwr   value	kwargs_nwvbbackendsrF  r   r  r  r  funcr  r  s               r   wrapper.narwhalify.<locals>.decorator.<locals>.wrapper  s(     
  C !-).G +!-    
* $*<<>
 $2KD k!-).G +!-  $2  
 978Y%5%5%788A $:DAAAA 8   !A%w o%70i0FV,??I

s   CC	(CC)r  r   r	  r   r   r   r   )r  r  r  r  r  r  r  s   ` r   	decoratornarwhalify.<locals>.decorator  s)    	t%	@ %	@ 
%	@N r   )r  Callable[..., Any]r   r  r  )r  r  r  r  r  r  r  r  s     ````` r   
narwhalifyr    s8      34L) )V |T?r   c                 >    [        [        R                  " 5       5      $ r   )r   r  r   r   r   r   r   r         bffhr   c                 :    [        [        R                  " U 6 5      $ r   )r   r  colnamess    r   r  r    s    bffen%%r   c                 :    [        [        R                  " U 6 5      $ r   )r   r  excluder  s    r   r  r  !  s    bjj%())r   c                 :    [        [        R                  " U 6 5      $ r   )r   r  nth)indicess    r   r  r  %      bffg&''r   c                 >    [        [        R                  " 5       5      $ r   )r   r  lenr   r   r   r  r  )  r  r   c                @    [        [        R                  " X5      5      $ r   )r   r  lit)r  r0  s     r   r   r   -  s    bffU*++r   c                 :    [        [        R                  " U 6 5      $ r   )r   r  mincolumnss    r   r  r  1  r  r   c                 :    [        [        R                  " U 6 5      $ r   )r   r  maxr  s    r   r  r  5  r  r   c                 :    [        [        R                  " U 6 5      $ r   )r   r  meanr  s    r   r  r  9  s    bggw'((r   c                 :    [        [        R                  " U 6 5      $ r   )r   r  medianr  s    r   r
  r
  =  s    bii)**r   c                 :    [        [        R                  " U 6 5      $ r   )r   r  sumr  s    r   r  r  A  r  r   c                 :    [        [        R                  " U 6 5      $ r   )r   r  sum_horizontalexprss    r   r  r  E      b''/00r   rH  c                @    [        [        R                  " USU 065      $ NrI  )r   r  all_horizontalrI  r  s     r   r  r  I       b''J\JKKr   c                @    [        [        R                  " USU 065      $ r  )r   r  any_horizontalr  s     r   r  r  O  r  r   c                 :    [        [        R                  " U 6 5      $ r   )r   r  mean_horizontalr  s    r   r  r  U  s    b((%011r   c                 :    [        [        R                  " U 6 5      $ r   )r   r  min_horizontalr  s    r   r  r  Y  r  r   c                 :    [        [        R                  " U 6 5      $ r   )r   r  max_horizontalr  s    r   r  r  ]  r  r   c                >    [        [        R                  " XUS95      $ )zCompute the Pearson's or Spearman rank correlation between two columns.

Arguments:
    a: Column name or Expression
    b: Column name or Expression
    method: Correlation method ('pearson' or 'spearman')
)method)r   r  corr)ar  r   s      r   r!  r!  a  s     bgga6233r   r  ddofc               >    [        [        R                  " XUS95      $ )a  Compute the covariance between two columns.

Arguments:
    a: Column name or Expression
    b: Column name or Expression
    ddof: "Delta Degrees of Freedom": the divisor used in the calculation is N - ddof,
        where N represents the number of elements. By default ddof is 1.
r#  )r   r  cov)r"  r  r$  s      r   r&  r&  n  s     bffQ-..r    	separatorrI  c               H    [        [        R                  " U /UQ7XS.65      $ )Nr(  )r   r  
concat_str)r  r)  rI  
more_exprss       r   r+  r+  z  s'     
eYjYIY r   c                B    [        [        R                  " U /UQ76 5      $ )zFormat expressions as a string.)r   r  format)f_stringr  s     r   r.  r.    s    bii04011r   c                B    [        [        R                  " U /UQ76 5      $ r   )r   r  coalesce)r  r,  s     r   r1  r1    s    bkk%5*566r   c                    U R                   $ )a}  Level of support Narwhals has for current object.

Arguments:
    obj: Dataframe or Series.

Returns:
    This can be one of

        - 'full': full Narwhals API support
        - 'lazy': only lazy operations are supported. This excludes anything
          which involves iterating over rows in Python.
        - 'interchange': only metadata operations are supported (`df.schema`)
)r  r  s    r   	get_levelr3    s      ::r   c                  2    \ rS rSr\SS j5       rSS jrSrg)Wheni  c                $    U " UR                   SS9$ )Nr   )chain)
_predicate)r   whens     r   	from_whenWhen.from_when  s    4??"--r   c                f    / U R                   QU R                  U4P7n[        R                  U5      $ r   )_chainr8  Then_from_chain)r   r  	new_chains      r   then	When.then  s/    <dkk<DOOU#;<		**r   r   N)r9  z	nw_f.Whenr   r5  )r  z&IntoExpr | NonNestedLiteral | _1DArrayr   r>  )r   r   r   r   r   r:  rA  r   r   r   r   r5  r5    s    . .+r   r5  c                  6   ^  \ rS rSrSS jrSU 4S jjrSrU =r$ )r>  i  c                ,    [        USU R                  06$ )Nr7  )r5  r=  )r   
predicatess     r   r9  	Then.when  s    Z3t{{33r   c                4   > [        [        TU ]	  U5      5      $ r   )r   r   	otherwise)r   otherwise_valuer   s     r   rH  Then.otherwise  s    %'+O<==r   r   rE  IntoExpr | Iterable[IntoExpr]r   r5  )rI  zIntoExpr | NonNestedLiteralr   r$   )r   r   r   r   r9  rH  r   r   r   s   @r   r>  r>    s    4> >r   r>  c                 N    [         R                  [        R                  " U 6 5      $ r   )r5  r:  nw_fr9  )rE  s    r   r9  r9    s    >>$))Z011r   )required)r   native_namespacec          	     @    [        SU5      n[        [        XX#S95      $ )a-  Instantiate Narwhals Series from iterable (e.g. list or array).

See `narwhals.new_series` for full docstring. Note that `native_namespace` is
an is the same as `backend` but only accepts module types - for new code, we
recommend using `backend`, as that's available beyond just `narwhals.stable.v1`.
r   r   )r
   r   r%   )r   r/  r0  r   rP  s        r   
new_seriesrR    s$     ;WEG&tULMMr   c               T    [        SU5      n[        [        R                  " XS95      $ )a:  Construct a DataFrame from an object which supports the PyCapsule Interface.

See `narwhals.from_arrow` for full docstring. Note that `native_namespace` is
an is the same as `backend` but only accepts module types - for new code, we
recommend using `backend`, as that's available beyond just `narwhals.stable.v1`.
r   r   )r
   r   rN  r   )r   r   rP  s      r   r   r     s%     ;WEGdoolDEEr   c               >    [        [        R                  " XUS95      $ )a  Instantiate DataFrame from dictionary.

See `narwhals.from_dict` for full docstring. Note that `native_namespace` is
an is the same as `backend` but only accepts module types - for new code, we
recommend using `backend`, as that's available beyond just `narwhals.stable.v1`.
r   )r   rN  r   r   r   r   rP  s       r   r   r     s     dnnT7CDDr   r   r   c               V    [        SU5      n[        [        R                  " XUS95      $ )a  Construct a DataFrame from a NumPy ndarray.

See `narwhals.from_numpy` for full docstring. Note that `native_namespace` is
an is the same as `backend` but only accepts module types - for new code, we
recommend using `backend`, as that's available beyond just `narwhals.stable.v1`.
r   r   )r
   r   rN  r   rU  s       r   r   r     s'     ;WEGdoodGDEEr   c               ^    [        SU5      n[        [        R                  " U 4SU0UD65      $ )a  Read a CSV file into a DataFrame.

See `narwhals.read_csv` for full docstring. Note that `native_namespace` is
an is the same as `backend` but only accepts module types - for new code, we
recommend using `backend`, as that's available beyond just `narwhals.stable.v1`.
r   r   )r
   r   rN  read_csvsourcer   rP  r	  s       r   rX  rX    s/     ;WEGdmmFFGFvFGGr   c               ^    [        SU5      n[        [        R                  " U 4SU0UD65      $ )a  Lazily read from a CSV file.

See `narwhals.scan_csv` for full docstring. Note that `native_namespace` is
an is the same as `backend` but only accepts module types - for new code, we
recommend using `backend`, as that's available beyond just `narwhals.stable.v1`.
!IntoBackend[Backend | PluginName]r   )r
   r   rN  scan_csvrY  s       r   r]  r]    s/     6@GdmmFFGFvFGGr   c               ^    [        SU5      n[        [        R                  " U 4SU0UD65      $ )a  Read into a DataFrame from a parquet file.

See `narwhals.read_parquet` for full docstring. Note that `native_namespace` is
an is the same as `backend` but only accepts module types - for new code, we
recommend using `backend`, as that's available beyond just `narwhals.stable.v1`.
r   r   )r
   r   rN  read_parquetrY  s       r   r_  r_  %  s1     ;WEGd''JJ6JKKr   c               ^    [        SU5      n[        [        R                  " U 4SU0UD65      $ )a  Lazily read from a parquet file.

See `narwhals.scan_parquet` for full docstring. Note that `native_namespace` is
an is the same as `backend` but only accepts module types - for new code, we
recommend using `backend`, as that's available beyond just `narwhals.stable.v1`.
r\  r   )r
   r   rN  scan_parquetrY  s       r   ra  ra  7  s1     6@Gd''JJ6JKKr   c                 @    [        [        R                  " U 0 UD65      $ )a  Collect columns into a struct column.

Arguments:
    *exprs: Column(s) to collect into a struct column, specified as
        positional arguments. Accepts only expression input. Strings are parsed
        as column names, other non-expression inputs are not allowed.
    **named_exprs: Additional columns to collect into the struct column,
        specified as keyword arguments. The columns will be renamed to the
        keyword used.
)r   rN  struct)r  named_exprss     r   rc  rc  I  s     dkk58K899r   )Yr-   r.   r/   r0   r    r1   r2   r3   r4   r5   r$   r6   r7   r8   r9   r   r:   r;   r<   r=   r>   r"   r!   r?   r@   r(   r)   rA   rB   rC   rD   rE   rF   rG   rH   rI   r   r  r  r1  r  r&   r+  r!  r&  r*   r+   r   r  r.  r   r   r   r  r   r   r3  rS   r   r   r  r   r  r  r   r   r   r   r   r  r  r
  r  r  r  rR  r  rX  r_  r]  ra  r,   r'   rc  r  r  r  rT   r9  )r  zNwDataFrame[IntoDataFrameT]r   DataFrame[IntoDataFrameT])r  zNwLazyFrame[IntoLazyFrameT]r   LazyFrame[IntoLazyFrameT])r  zNwSeries[IntoSeriesT]r   Series[IntoSeriesT])r  r  r   r$   )r  zZNwDataFrame[IntoDataFrameT] | NwLazyFrame[IntoLazyFrameT] | NwSeries[IntoSeriesT] | NwExprr   zRDataFrame[IntoDataFrameT] | LazyFrame[IntoLazyFrameT] | Series[IntoSeriesT] | Expr)r  rQ   r  Unpack[OnlySeries]r   rQ   )r  rQ   r  Unpack[OnlySeriesStrict]r   rQ   )r  rQ   r  Unpack[AllowSeries]r   rQ   )r  rQ   r  Unpack[AllowSeriesStrict]r   rQ   )r  rJ   r  Unpack[ExcludeSeries]r   rJ   )r  rJ   r  Unpack[ExcludeSeriesStrict]r   rJ   )r  rP   r  Unpack[AllowLazy]r   rP   )r  rP   r  Unpack[AllowLazyStrict]r   rP   )r  rK   r  zUnpack[OnlyEagerOrInterchange]r   re  )r  rK   r  z$Unpack[OnlyEagerOrInterchangeStrict]r   re  )r  rK   r  rl  r   re  )r  rK   r  rm  r   re  )r  rO   r  rh  r   rg  )r  rO   r  ri  r   rg  )r  IntoDataFrameT | IntoSeriesTr  rj  r   /DataFrame[IntoDataFrameT] | Series[IntoSeriesT])r  rp  r  rk  r   rq  )r  rM   r  rn  r   rf  )r  rM   r  ro  r   rf  )r  -IntoDataFrameT | IntoLazyFrameT | IntoSeriesTr  zUnpack[AllowAny]r   KDataFrame[IntoDataFrameT] | LazyFrame[IntoLazyFrameT] | Series[IntoSeriesT])r  rr  r  zUnpack[AllowAnyStrict]r   rs  )r  r   r  zUnpack[PassThroughUnknown]r   r   )r  r   r  zUnpack[StrictUnknown]r   r   )r  r   r  r   r  r   r  r   r  r   r  r  r   r   )r  zJIntoDataFrameT | IntoLazyFrameT | IntoFrame | IntoSeriesT | IntoSeries | Tr  r  r  r  r  r   r  r   r  r   r  r  r  r   r   zOLazyFrame[IntoLazyFrameT] | DataFrame[IntoDataFrameT] | Series[IntoSeriesT] | T)r  re  r  Literal[True] | Noner   rK   )r  rf  r  rt  r   rM   )r  rg  r  rt  r   rO   )r  r   r  r   r   r   )r  re  r  Literal[False] | Noner   rK   )r  rf  r  ru  r   rM   )r  rg  r  ru  r   rO   )r  r   r  r   r   r   )r  rs  r  r  r  r  r   z3IntoLazyFrameT | IntoDataFrameT | IntoSeriesT | Anyr   )r  zCallable[..., Any] | Noner  r  r  r  r  r   r  r   r  r   r  r  r   r  )r   r$   )r  zstr | Iterable[str]r   r$   )r  zint | Sequence[int]r   r$   )r  r{   r0  rM  r   r$   )r  r   r   r$   )r  rL  r   r$   )r  rL  rI  r   r   r$   )pearson)r"  ry   r  ry   r   zLiteral['pearson', 'spearman']r   r$   )r"  ry   r  ry   r$  r#  r   r$   )
r  rL  r,  ry   r)  r   rI  r   r   r$   )r/  r   r  ry   r   r$   )r  rL  r,  ry   r   r$   )r  z5DataFrame[Any] | LazyFrame[Any] | Series[IntoSeriesT]r   r   rK  )r   r   r/  r   r0  rM  r   r   rP  ModuleType | Noner   r   )r   rf   r   r   rP  rw  r   r   )
r   r   r   r   r   r   rP  rw  r   r   )
r   r   r   r   r   r   rP  rw  r   r   )
rZ  rw   r   r   rP  rw  r	  r   r   r   )
rZ  rw   r   z(IntoBackend[Backend | PluginName] | NonerP  rw  r	  r   r   r   )r  zIntoExpr | Sequence[IntoExpr]rd  ry   r   r$   )
__future__r   	functoolsr   typingr   r   r   r	   r
   r   narwhalsr  r   r   rN  narwhals._exceptionsr   narwhals._expression_parsingr   r   r   narwhals._typing_compatr   r   r  r   r   r   r   r   r   r   r   r   r   r   r   narwhals.dataframer    r   r!   r'  narwhals.exceptionsr"   r#   narwhals.exprr$   r  narwhals.functionsr%   r&   r'   narwhals.schemar(   NwSchemanarwhals.seriesr)   rO  narwhals.stable.v1r*   r+   r,   narwhals.stable.v1.dtypesr-   r.   r/   r0   r1   r2   r3   r4   r5   r6   r7   r8   r9   r:   r;   r<   r=   r>   r?   r@   rA   rB   rC   rD   rE   rF   rG   rH   rI   narwhals.stable.v1.typingrJ   rK   rL   rM   rN   rO   rP   rQ   narwhals.translaterR   rS   rT   collections.abcrU   rV   rW   rX   typesrY   typing_extensionsrZ   r[   r\   r]   narwhals._translater^   AllowAnyStrictr_   AllowAnyr`   AllowLazyStrictra   	AllowLazyrb   AllowSeriesStrictrc   AllowSeriesrd   ExcludeSeriesStrictre   ExcludeSeriesrf   rg   rh   ri   OnlySeriesStrictrj   
OnlySeriesrk   PassThroughUnknownrl   StrictUnknownnarwhals._typingrm   rn   ro   rp   rq   rr   rs   rt   ru   rv   narwhals.typingrw   rx   ry   rz   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  r  r  r  r  r!  r&  r+  r.  r1  r3  r5  r>  r9  rR  r   r   r   __annotations__r   rX  r]  r_  ra  rc  __all__r   r   r   <module>r     s   "  E E  2 . D D 9    R M ( F F . . > >       >	 	 	 U TEE 999    "	 	 	 H   	S!A#AAD-N+ D-N1
N+ 1
hR<Xk" R<ja
6 a
HX  
 R 
 R	 R 
 R	 F 
 F	 ( 
 (

 X" 
 S 
 S	 Y 
 Y	 T 
 T	 Z 
 Z	'< 
 
'B 
 
 X 
 X	'> 
 
$!$+I$$ 
$ 
$!$+O$$ 
$ 
$!$+@$$ 
$ 
$!$+F$$ 
$ 
(: 
 
(@ 
 
:/:9L:4: 
: 
:/:9R:4: 
: 
$!$+<$$ 
$ 
$!$+B$$ 
$ 
V@VJZVPV 
V 
V@V"V QV 
V 
 O 
 O	 J 
 J 
 ',  	
  $   	 
&  $&+ $++ + + +  $+ + + + U+\ 
RU.;O 
 
RU.;O 
 
LO(5I 
 
 @ 
 @	 +.. ( 	 

 
 +.. ( 	 

 
SV(;P 
 
 F 
 F  $DD
 D D 9D. '+B  $&+ $B
#B B 	B
 B  $B B B BJ &*( ,(()+(1
 AFL)L9=L	L AFL)L9=L	L211
 HQ
4
4
4&D
4	
4 23 	/ 	(  	
 
2
7	>+&+499 +>499d >2 T* #N
 >B*.N
NN N
 ;N (N N +N$ T* >B*.	F F ;F (	F
 F +F   BFE >B*.E
E>E ;	E
 (E E E  ((
E ( T* 15F >B*.F
F-F ;	F
 (F F +F" T* >B*.	HH ;H (	H
 H H +H" T* 9=*.	HH 6H (	H
 H H +H" T* >B*.	LL ;L (	L
 L L +L" T* 9=*.	LL 6L (	L
 L L +L":Zr   