
    Wh                   $   U d dl mZ d dlmZ d dlmZ d dl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 d dlmZmZmZmZ d dlmZmZmZm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+m,Z,m-Z-m.Z.m/Z/ d d	l0m1Z1m2Z2 d d
l3m4Z4m5Z5m6Z6m7Z7 d dl8m9Z9m:Z: d dl;m<Z< d dl=m>Z> d dl?m@Z@ erd dlAmBZBmCZCmDZDmEZE d dlFmGZG d dlHmIZI d dlJmKZK d dlLZMd dlNZOd dlPZQd dlRmSZSmTZTmUZUmVZV d dlWmXZXmYZY d dlZm[Z[m\Z\ d dl]m^Z^ d dlm_Z_m`Z`maZambZb d dlcmdZdmeZe d dlfmgZgmhZhmiZimjZjmkZkmlZlmmZmmnZompZqmrZrmsZsmtZtmuZumvZvmwZw  eTd      ZxeZydezd<    edd       Z{ ed!d"       Z| ed#d$       Z} ed%      Z~d&Zndezd'<   d(Zpdezd)<    G d* d+ee{         Z G d, d-ee}         Z G d. d/ee|         Zy)0    )annotations)abstractmethod)chain)
TYPE_CHECKINGAnyCallableClassVarGenericLiteralNoReturnTypeVarget_argsoverload)issue_warning)ExprKind!check_expressions_preserve_lengthis_into_expr_eageris_scalar_like)ArrowPandas_LazyAllowedImpl_LazyFrameCollectImpl)ImplementationVersion_Implementationcan_lazyframe_collectcheck_columns_existflattengenerate_repris_compliant_dataframeis_compliant_lazyframeis_eager_allowedis_index_selectoris_lazy_allowed
is_list_ofis_sequence_likeis_slice_nonequalified_type_namesupports_arrow_c_stream
zip_strict)is_numpy_array_2dis_pyarrow_table)ColumnNotFoundErrorInvalidIntoExprErrorInvalidOperationErrorPerformanceWarning)_from_dict_no_backend_is_into_schema)SchemaSeries	to_native)IterableIteratorMappingSequence)BytesIO)Path)
ModuleTypeN)Concatenate	ParamSpecSelf	TypeAlias)CompliantDataFrameCompliantLazyFrame)CompliantExprAnyEagerNamespaceAny)IntoArrowTable)EagerAllowedIntoBackendLazyAllowedPolars)GroupByLazyGroupBy)AsofJoinStrategyIntoDataFrameIntoExpr	IntoFrameIntoLazyFrame
IntoSchemaJoinStrategyMultiColSelectorMultiIndexSelectorPivotAggSingleColSelectorSingleIndexSelectorSizeUnitUniqueKeepStrategy_2DArrayPSrB   
Incomplete_FrameTrQ   )bound
LazyFrameTrR   
DataFrameTrO   Rz_MultiColSelector[Series[Any]]rU   z _MultiIndexSelector[Series[Any]]rV   c                     e Zd ZU ded<   ded<    e       Zded<   	 eed(d              Zd)dZ	d(d	Z
d*d
Z	 	 	 	 	 	 d+dZed,d       Zd-dZd.dZed/d       Zd/dZ	 	 	 	 	 	 	 	 d0dZd1dZed2d       Z	 	 	 	 	 	 d3dZ	 	 	 	 	 	 d3dZd4dZd5dZd5dZd6dZ	 	 	 	 	 	 d7dZddd	 	 	 	 	 	 	 	 	 d8dZdd	 	 	 	 	 	 	 d9dZ	 	 	 	 	 	 	 	 	 	 	 	 	 	 d:d Zd;d<d!Z	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 d=d"Z 	 	 	 	 	 	 	 	 	 	 d>d#Z!d?d$Z"d?d%Z#d@d&Z$y')A	BaseFramer   _compliant_frame&Literal['full', 'lazy', 'interchange']_levelr   implementationc                     y N selfs    L/var/www/html/jupyter_env/lib/python3.12/site-packages/narwhals/dataframe.py
_compliantzBaseFrame._compliant   s    !$    c                6    | j                   j                         S rk   )rf   __native_namespace__rm   s    ro   rs   zBaseFrame.__native_namespace__   s    $$99;;rq   c                6    | j                   j                         S rk   )rf   __narwhals_namespace__rm   s    ro   ru   z BaseFrame.__narwhals_namespace__   s    $$;;==rq   c                <    | j                  || j                        S )Nlevel)	__class__rh   )rn   dfs     ro   _with_compliantzBaseFrame._with_compliant   s    ~~b~44rq   c                   g }g }t        |      D ]J  }| j                  |      }|j                  |       |j                  t        j                  |d             L |j                         D ]\  \  }}| j                  |      j                  |      }|j                  |       |j                  t        j                  |d             ^ ||fS NF
str_as_lit)r   _extract_compliantappendr   from_into_expritemsalias)rn   exprsnamed_exprs	out_exprs	out_kindsexprcompliant_exprr   s           ro   _flatten_and_extractzBaseFrame._flatten_and_extract   s    
 		EN 	ND!44T:N^,X44TeLM	N ',,. 	NKE4!44T:@@GN^,X44TeLM	N )##rq   c                    t         rk   NotImplementedError)rn   args     ro   r   zBaseFrame._extract_compliant   s    !!rq   c                   t        |t        |             r|j                  S dt        |       dt        |      }t	        |      )NzExpected `other` to be a , got: )
isinstancetyperf   r(   	TypeErrorrn   othermsgs      ro   _extract_compliant_framez"BaseFrame._extract_compliant_frame   sG    eT$Z())))*=d*C)FgNabgNhMklnrq   c                0    t        || j                        S )N)	available)r   columnsrn   subsets     ro   _check_columns_existzBaseFrame._check_columns_exist   s    "6T\\BBrq   c                \    t        | j                  j                  j                               S rk   )r3   rf   schemar   rm   s    ro   r   zBaseFrame.schema   s"    d++2288:;;rq   c                ^    t        | j                  j                               }t        |      S rk   )dictrf   collect_schemar3   )rn   native_schemas     ro   r   zBaseFrame.collect_schema   s&    T22AACDm$$rq   c                     || g|i |S rk   rl   )rn   functionargskwargss       ro   pipezBaseFrame.pipe   s     .t.v..rq   c                    t        |t              r|gn|}| j                  | j                  j	                  |            S )Nr   )r   strr{   rf   
drop_nullsr   s     ro   r   zBaseFrame.drop_nulls   s9    '4&&##D$9$9$D$DF$D$STTrq   c                .    | j                   j                  S rk   )rf   r   rm   s    ro   r   zBaseFrame.columns   s    $$,,,rq   c                     | j                   |i |\  }}t        ||      D cg c]#  \  }}t        |      r|j                  |      n|% }}}| j	                   | j
                  j                  |       S c c}}w rk   )r   r*   r   	broadcastr{   rf   with_columns)rn   r   r   compliant_exprskindsr   kinds          ro   r   zBaseFrame.with_columns   s     ";!:!:E!Q[!Q )3?E(J
$ /=T.BN$$T*V
 
 ##$FD$9$9$F$F$XYY	
s   (A8c                j   t        t        |            }|r=t        d |D              r+|s)	 | j                   | j                  j
                  |       S  | j                  |i |\  }}|r:t        d |D              r(| j                   | j                  j                  |       S t        ||      D 	cg c]#  \  }}	t        |	      r|j                  |	      n|% }}}	| j                   | j                  j                  |       S # t        $ r}| j                  |      x}r|| d }~ww xY wc c}	}w )Nc              3  <   K   | ]  }t        |t                y wrk   r   r   ).0xs     ro   	<genexpr>z#BaseFrame.select.<locals>.<genexpr>   s     EQjC0E   c              3  2   K   | ]  }t        |        y wrk   )r   r   r   s     ro   r   z#BaseFrame.select.<locals>.<genexpr>   s     "JD>$#7"Js   )tupler   allr{   rf   simple_select	Exceptionr   r   	aggregater*   r   r   select)
rn   r   r   
flat_exprseerrorr   r   r   r   s
             ro   r   zBaseFrame.select   sD    75>*
#E*EEk++7D))77D  ";!:!:J!V+!Vs"JE"JJ''(G(=(=(G(G(YZZ )3?E(J
$ /=T.BN$$T*V
 
 ##$@D$9$9$@$@/$RSS   55jAA5AQ&	
s   'D 4(D/	D,D''D,c                V    | j                  | j                  j                  |            S rk   )r{   rf   rename)rn   mappings     ro   r   zBaseFrame.rename   s$    ##D$9$9$@$@$IJJrq   c                V    | j                  | j                  j                  |            S rk   )r{   rf   headrn   ns     ro   r   zBaseFrame.head   $    ##D$9$9$>$>q$ABBrq   c                V    | j                  | j                  j                  |            S rk   )r{   rf   tailr   s     ro   r   zBaseFrame.tail   r   rq   c               Z    | j                  | j                  j                  ||            S )Nstrict)r{   rf   drop)rn   r   r   s      ro   r   zBaseFrame.drop   s)    ##D$9$9$>$>wv$>$VWWrq   c                  	 t        |      dk(  rt        |d   t              r|d   }ntddlm t        |      }t        |ddi | j                         	 | j                  | \  }}	fd|j                         D        } 	j                  t        ||      ddi}| j                  | j                  j                  |            S )	N   r   colfunction_namefilterc              3  X   K   | ]!  \  }} |      |k(  j                         # y wrk   )_to_compliant_expr)r   namevr   plxs      ro   r   z#BaseFrame.filter.<locals>.<genexpr>   s0      %D! Ta33C8%s   '*ignore_nullsF)lenr%   boolnarwhals.functionsr   r   r   ru   r   r   all_horizontalr   r{   rf   r   )
rn   
predicatesconstraints	predicateflat_predicatescompliant_predicates_kindscompliant_constraintsr   r   s
           @@ro   r   zBaseFrame.filter   s     z?aJz!}d$C"1I.%j1O-WhW--/C+D4+D+Do+V( &%*002%! +**+-BCRWI ##D$9$9$@$@$KLLrq   F
descending
nulls_lastc                   t        g t        |g      |      }| j                   | j                  j                  |||d      S )Nr   )r   r{   rf   sort)rn   byr   r   more_bys        ro   r   zBaseFrame.sort	  sL     /wt}/w/0##&D!!&&zjY
 	
rq   reversec               t    t        |g      }| j                  | j                  j                  |||            S )Nr   r   )r   r{   rf   top_k)rn   kr   r   
flatten_bys        ro   r   zBaseFrame.top_k  s=     bT]
##!!''j''J
 	
rq   c               h   d}t        |t              r|gn|}t        |t              r|gn|}t        |t              r|gn|}| j                  }| j                  |      }||vrd| d| d}	t	        |	      |dk(  r*|||d}	t        |	      |j                  ||d d |      }
n}|P||d| d	}	t        |	      t        |      t        |      k7  rd
}	t        |	      |j                  |||||      }
n+||d| d	}	t        |	      |j                  |||||      }
| j                  |
      S )N)innerleftfullcrossantisemiz2Only the following join strategies are supported: 	; found ''.r   z>Can not pass `left_on`, `right_on` or `on` keys for cross join)howleft_onright_onsuffixzGEither (`left_on` and `right_on`) or `on` keys should be specified for .z3`left_on` and `right_on` must have the same length.zBIf `on` is specified, `left_on` and `right_on` should be None for )	r   r   rf   r   r   
ValueErrorjoinr   r{   )rn   r   onr  r  r  r  _supported_joins	compliantr   results              ro   r	  zBaseFrame.join  s    NC(bTb)'377)W!+Hc!:H:))	--e4&&FGWFXXabeaffhiC%c**'>"h&:bnV o%^^3tF $ F Z("2_`c_ddef o%7|s8},K o%^^3(6 $ F "h&:Z[^Z__`a o%^^3R $ F ##F++rq   c                Z    | j                  | j                  j                  ||            S )Nr   offset)r{   rf   gather_every)rn   r   r  s      ro   r  zBaseFrame.gather_everyK  s.    ##!!..6.B
 	
rq   c               J   d}
||
vrd|
 d| d}t        |      |||d}t        |      |||d}t        |      |||||d}t        |      |||d}t        |      ||x}}||x}}t        |t              r|gn|}t        |t              r|gn|}t        |t              r4t        |t              r$t        |      t        |      k7  rd	}t        |      | j                  | j                  j                  | j                  |      ||||||	
            S )N)backwardforwardnearestz-Only the following strategies are supported: r  r  zCEither (`left_on` and `right_on`) or `on` keys should be specified.z>If `on` is specified, `left_on` and `right_on` should be None.zGCan not specify only `by_left` or `by_right`, you need to specify both.z>If `by` is specified, `by_left` and `by_right` should be None.z3`by_left` and `by_right` must have the same length.)r  r  by_leftby_rightstrategyr  )
r   r  r   r   listr   r{   rf   	join_asofr   )rn   r   r  r  r
  r  r  r   r  r  _supported_strategiesr   s               ro   r  zBaseFrame.join_asofP  s    !C00ABWAXXabjakkmnC%c**JW_0@WCS/!N!48LRCS/!J_!5#(8 Z  S/!N!48LRCS/!>!##Gh>!##Gh)'377)W!+Hc!:H:w%*Xt*DLCM)GCS/!##!!++--e4!!! , 

 
	
rq   c                   t        |t              r|gn|}t        |t              r|gn|}| j                  | j                  j	                  ||||            S )Nr
  indexvariable_name
value_name)r   r   r{   rf   unpivot)rn   r
  r  r  r   s        ro   r!  zBaseFrame.unpivot  s]      C(bTb%eS1u##!!))U-J * 
 	
rq   c                    d}t        |      )NzDataFrame.__neq__ and LazyFrame.__neq__ are not implemented, please use expressions instead.

Hint: instead of
    df != 0
you may want to use
    df.select(nw.all() != 0)r   r   s      ro   __neq__zBaseFrame.__neq__      + 	 "#&&rq   c                    d}t        |      )NzDataFrame.__eq__ and LazyFrame.__eq__ are not implemented, please use expressions instead.

Hint: instead of
    df == 0
you may want to use
    df.select(nw.all() == 0)r   r   s      ro   __eq__zBaseFrame.__eq__  r$  rq   c                    t        |t              r|g|ng ||}| j                  | j                  j	                  |            S )Nr   )r   r   r{   rf   explode)rn   r   more_columns
to_explodes       ro   r)  zBaseFrame.explode  sT     '3' $|$*7*\* 	 ##D$9$9$A$A*$A$UVVrq   N)returnr   )r,  r>   )rz   r   r,  rA   )r   IntoExpr | Iterable[IntoExpr]r   rP   r,  z-tuple[list[CompliantExprAny], list[ExprKind]]r   r   r,  r   )r   z
Self | Anyr,  r   )r   zSequence[str]r,  zColumnNotFoundError | Noner,  r3   r   z"Callable[Concatenate[Self, PS], R]r   zPS.argsr   z	PS.kwargsr,  rc   r   str | list[str] | Noner,  rA   r,  z	list[str]r   r-  r   rP   r,  rA   r   zdict[str, str]r,  rA   r   intr,  rA   )r   zIterable[str]r   r   r,  rA   r   z*IntoExpr | Iterable[IntoExpr] | list[bool]r   r   r,  rA   
r   str | Iterable[str]r   r   r   bool | Sequence[bool]r   r   r,  rA   r   r7  r   r:  r   r;  r,  rA   )r   r^   r
  r2  r  rT   r  r2  r  r2  r  r   r,  rA   r   r   r7  r  r7  r,  rA   )r   r^   r  
str | Noner  r?  r
  r?  r  r2  r  r2  r   r2  r  rN   r  r   r,  rA   
r
  r2  r  r2  r  r   r   r   r,  rA   )r   objectr,  r   r   str | Sequence[str]r*  r   r,  rA   )%__name__
__module____qualname____annotations__r   ri   propertyr   rp   rs   ru   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)  rl   rq   ro   re   re   h   s   22&5&7NO7( $  $<>5$3$DL$	6$" " "C < <%
/4/ / 	/
 
/U - -Z3ZDLZ	ZT3TDLT	T0KCCXMEMVYM	M2 -2 



 

 *	


 

 


 TY

0
;P
	
,,,, #,, 	,, (,, ),, ,, 
,,\

<
<
 	<

 <
 <
 (<
 )<
 #<
 #<
 <
 
<
|
"
 &	

 
 
 

"	'	'Wrq   re   c            	      f    e Zd ZU dZej
                  Zded<   edld       Z	dmdZ
ednd       Zedod       ZdpdZe	 	 	 	 	 	 dqd	       Ze	 drd
d	 	 	 	 	 	 	 dsd       Ze	 dr	 	 	 	 	 	 	 dtd       ZdudZdvdwdZdxdZdrdydZ	 drd
d	 	 	 	 	 dzdZd{dZd|dZd}dZedrd~d       Zedd       ZdrddZddZddZedd       ZddZdddZ edd       Z!e	 	 	 	 dd        Z!e	 	 	 	 dd!       Z!	 	 	 	 dd"Z!dd#Z"ed$d%dd&       Z#edd'       Z#ed(d%	 	 	 dd)       Z#d(d%	 	 	 dd*Z#dd+Z$	 	 	 	 	 	 	 	 d fd,Z%drd fd-Z&	 dd
d.	 	 	 	 	 dd/Z'ed fd0       Z(d fd1Z)ed fd2       Z*ed3d4dd5       Z+edd6       Z+edd7       Z+d3d4	 	 	 dd8Z+dd9Z,ed$d$d:	 	 	 	 	 dd;       Z-ed$d<	 	 	 	 	 dd=       Z-ed$d<	 	 	 	 	 dd>       Z-d3d?d:	 	 	 	 	 dd@Z-	 	 	 	 	 	 d fdAZ.	 	 	 	 	 	 d fdBZ/d fdCZ0dd fdDZ1dd fdEZ2d(dFd fdGZ3	 drdHd3d
dI	 	 	 	 	 	 	 	 	 ddJZ4	 	 	 	 	 	 d fdKZ5ed$dL	 	 	 	 	 ddM       Z6e	 	 	 	 	 	 ddN       Z6d3dL	 	 	 	 	 ddOZ6d3d3dP	 	 	 	 	 	 	 	 	 d fdQZ7d3dR	 	 	 	 	 	 	 d fdSZ8	 	 dd
d
dTdU	 	 	 	 	 	 	 	 	 	 	 	 	 d fdVZ9d
d
d
d
d
d
dWdTdX	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 d fdYZ:ddZZ;dd[Z<dd\Z=dd]Z>dvdd^Z?dd_Z@dd fd`ZAd
d
d
d
d3dadb	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 ddcZBdddZC	 drd
d3d
de	 	 	 	 	 	 	 	 	 ddfZD	 drd
dgdhdi	 	 	 	 	 	 	 	 	 d fdjZEd fdkZF xZGS )	DataFramea{  Narwhals DataFrame, backed by a native eager dataframe.

    Warning:
        This class is not meant to be instantiated directly - instead:

        - If the native object is a eager dataframe from one of the supported
            backend (e.g. pandas.DataFrame, polars.DataFrame, pyarrow.Table),
            you can use [`narwhals.from_native`][]:
            ```py
            narwhals.from_native(native_dataframe)
            narwhals.from_native(native_dataframe, eager_only=True)
            ```

        - If the object is a dictionary of column names and generic sequences mapping
            (e.g. `dict[str, list]`), you can create a DataFrame via
            [`narwhals.from_dict`][]:
            ```py
            narwhals.from_dict(
                data={"a": [1, 2, 3]},
                backend=narwhals.get_native_namespace(another_object),
            )
            ```
    zClassVar[Version]_versionc                    | j                   S rk   rf   rm   s    ro   rp   zDataFrame._compliant      $$$rq   c                    t        |      r#| j                         }|j                  |d      S t        j                  t        |            r}   )r   ru   parse_into_exprr.   from_invalid_typer   )rn   r   r   s      ro   r   zDataFrame._extract_compliant  sC    c"%)%@%@%BC&&su&=="44T#Y??rq   c                    t         S rk   r4   rm   s    ro   _serieszDataFrame._series  s    rq   c                    t         S rk   )	LazyFramerm   s    ro   
_lazyframezDataFrame._lazyframe      rq   c                   || _         |  t        |      r|j                         | _        y dt	        |       }t        |      )NzCExpected an object which implements `__narwhals_dataframe__`, got: )rh   r    __narwhals_dataframe__rf   r   AssertionErrorrn   rz   rx   r   s       ro   __init__zDataFrame.__init__  sD    >C!"%$&$=$=$?D!WX\]_X`WabC %%rq   c               t   t        |      s%t        |      sdt        |       d}t        |      t	        j
                  |      }t        |      rV| j                  j                  j                  |      j                  }|j                  j                  ||      } | |d      S | d| d}t        |      )u  Construct a DataFrame from an object which supports the PyCapsule Interface.

        Arguments:
            native_frame: Object which implements `__arrow_c_stream__`.
            backend: specifies which eager backend instantiate to.

                `backend` can be specified in various ways

                - As `Implementation.<BACKEND>` with `BACKEND` being `PANDAS`, `PYARROW`,
                    `POLARS`, `MODIN` or `CUDF`.
                - As a string: `"pandas"`, `"pyarrow"`, `"polars"`, `"modin"` or `"cudf"`.
                - Directly as a module `pandas`, `pyarrow`, `polars`, `modin` or `cudf`.

        Examples:
            >>> import pandas as pd
            >>> import polars as pl
            >>> import narwhals as nw
            >>>
            >>> df_native = pd.DataFrame({"a": [1, 2], "b": [4.2, 5.1]})
            >>> nw.DataFrame.from_arrow(df_native, backend="polars")
            ┌──────────────────┐
            |Narwhals DataFrame|
            |------------------|
            |  shape: (2, 2)   |
            |  ┌─────┬─────┐   |
            |  │ a   ┆ b   │   |
            |  │ --- ┆ --- │   |
            |  │ i64 ┆ f64 │   |
            |  ╞═════╪═════╡   |
            |  │ 1   ┆ 4.2 │   |
            |  │ 2   ┆ 5.1 │   |
            |  └─────┴─────┘   |
            └──────────────────┘
        zGiven object of type z% does not support PyCapsule interface)contextr   rw   z support in Narwhals is lazy-only, but `DataFrame.from_arrow` is an eager-only function.

Hint: you may want to use an eager backend and then call `.lazy`, e.g.:

    nw.DataFrame.from_arrow(df, backend='pyarrow').lazy(''))r)   r,   r   r   r   from_backendr"   rK  	namespacer  
_dataframe
from_arrowr  )clsnative_framebackendr   ri   nsr  s          ro   rc  zDataFrame.from_arrow  s    L (59I,9W)$|*<)==bcCC. '44W=N+''44^DNNB00r0JIy// HHVGWWY[ 	
 orq   N)rf  c               6   |t        |      \  }}t        j                  |      }t        |      rW| j                  j
                  j                  |      j                  }|j                  j                  |||      } | |d      S | d| d}t        |      )u)  Instantiate DataFrame from dictionary.

        Indexes (if present, for pandas-like backends) are aligned following
        the [left-hand-rule](../concepts/pandas_index.md/).

        Notes:
            For pandas-like dataframes, conversion to schema is applied after dataframe
            creation.

        Arguments:
            data: Dictionary to create DataFrame from.
            schema: The DataFrame schema as Schema or dict of {name: type}. If not
                specified, the schema will be inferred by the native library.
            backend: specifies which eager backend instantiate to. Only
                necessary if inputs are not Narwhals Series.

                `backend` can be specified in various ways

                - As `Implementation.<BACKEND>` with `BACKEND` being `PANDAS`, `PYARROW`,
                    `POLARS`, `MODIN` or `CUDF`.
                - As a string: `"pandas"`, `"pyarrow"`, `"polars"`, `"modin"` or `"cudf"`.
                - Directly as a module `pandas`, `pyarrow`, `polars`, `modin` or `cudf`.

        Examples:
            >>> import pandas as pd
            >>> import narwhals as nw
            >>> data = {"c": [5, 2], "d": [1, 4]}
            >>> nw.DataFrame.from_dict(data, backend="pandas")
            ┌──────────────────┐
            |Narwhals DataFrame|
            |------------------|
            |        c  d      |
            |     0  5  1      |
            |     1  2  4      |
            └──────────────────┘
        )r   r^  r   rw   z support in Narwhals is lazy-only, but `DataFrame.from_dict` is an eager-only function.

Hint: you may want to use an eager backend and then call `.lazy`, e.g.:

    nw.DataFrame.from_dict({'a': [1, 2]}, backend='pyarrow').lazy('r_  )
r1   r   r`  r"   rK  ra  r  rb  	from_dictr  )rd  datar   rf  ri   rg  r  r   s           ro   ri  zDataFrame.from_dict*  s    X ?1$7MD''44W=N+''44^DNNB//VR/PIy//  TTbScceg 	
 orq   c               t   t        |      sd}t        |      t        |      sdt        |       d}t	        |      t        j                  |      }t        |      rI| j                  j                  j                  |      j                  } | |j                  ||      d      S | d| d}t        |      )uq  Construct a DataFrame from a NumPy ndarray.

        Notes:
            Only row orientation is currently supported.

            For pandas-like dataframes, conversion to schema is applied after dataframe
            creation.

        Arguments:
            data: Two-dimensional data represented as a NumPy ndarray.
            schema: The DataFrame schema as Schema, dict of {name: type}, or a sequence of str.
            backend: specifies which eager backend instantiate to.

                `backend` can be specified in various ways

                - As `Implementation.<BACKEND>` with `BACKEND` being `PANDAS`, `PYARROW`,
                    `POLARS`, `MODIN` or `CUDF`.
                - As a string: `"pandas"`, `"pyarrow"`, `"polars"`, `"modin"` or `"cudf"`.
                - Directly as a module `pandas`, `pyarrow`, `polars`, `modin` or `cudf`.

        Examples:
            >>> import numpy as np
            >>> import polars as pl
            >>> import narwhals as nw
            >>>
            >>> arr = np.array([[5, 2, 1], [1, 4, 3]])
            >>> schema = {"c": nw.Int16(), "d": nw.Float32(), "e": nw.Int8()}
            >>> nw.DataFrame.from_numpy(arr, schema=schema, backend="polars")
            ┌───────────────────┐
            |Narwhals DataFrame |
            |-------------------|
            |shape: (2, 3)      |
            |┌─────┬─────┬─────┐|
            |│ c   ┆ d   ┆ e   │|
            |│ --- ┆ --- ┆ --- │|
            |│ i16 ┆ f32 ┆ i8  │|
            |╞═════╪═════╪═════╡|
            |│ 5   ┆ 2.0 ┆ 1   │|
            |│ 1   ┆ 4.0 ┆ 3   │|
            |└─────┴─────┴─────┘|
            └───────────────────┘
        z)`from_numpy` only accepts 2D numpy arrayszi`schema` is expected to be one of the following types: Mapping[str, DType] | Schema | Sequence[str]. Got r  r   rw   z support in Narwhals is lazy-only, but `DataFrame.from_numpy` is an eager-only function.

Hint: you may want to use an eager backend and then call `.lazy`, e.g.:

    nw.DataFrame.from_numpy(arr, backend='pyarrow').lazy('r_  )r+   r  r2   r   r   r   r`  r"   rK  ra  r  
from_numpy)rd  rj  r   rf  r   ri   rg  s          ro   rl  zDataFrame.from_numpye  s    d !&=CS/!v&F|nA' 
 C. '44W=N+''44^DNNBr}}T62&AA IIWHXXZ\ 	
 orq   c                6    | j                   j                         S rk   )rf   __len__rm   s    ro   rn  zDataFrame.__len__  s    $$,,..rq   c                <    | j                   j                  ||      S )Ncopy)rf   	__array__)rn   dtyperq  s      ro   rr  zDataFrame.__array__  s    $$..u4.@@rq   c                R    t        d| j                         j                               S )NzNarwhals DataFramer   r7   __repr__rm   s    ro   rv  zDataFrame.__repr__       14>>3C3L3L3NOOrq   c                ~   | j                   j                  }t        |      r|j                  |      S 	 t        j
                  j                         }|dk  rdt        |       }t        |      d| j                         }|j                  |      S # t        $ r}dt        |       }t        |      |d}~ww xY w)ah  Export a DataFrame via the Arrow PyCapsule Interface.

        - if the underlying dataframe implements the interface, it'll return that
        - else, it'll call `to_arrow` and then defer to PyArrow's implementation

        See [PyCapsule Interface](https://arrow.apache.org/docs/dev/format/CDataInterface/PyCapsuleInterface.html)
        for more.
        )requested_schemazT'pyarrow>=14.0.0' is required for `DataFrame.__arrow_c_stream__` for object of type N)   r   )
rf   _native_framer)   __arrow_c_stream__r   PYARROW_backend_versionModuleNotFoundErrorr   to_arrow)rn   ry  re  
pa_versionexcr   pa_tables          ro   r|  zDataFrame.__arrow_c_stream__  s     ,,::"<022DT2UU	4'//@@BJ himnzi{h|}C%c*4==?**<L*MM # 	4himnzi{h|}C%c*3	4s   B 	B<B77B<sessionc                  | j                   j                  }|| j                   |d|      d      S t        j                  |      }t        |      r| j                   |||      d      S dt        t               d| }t        |      )u  Restrict available API methods to lazy-only ones.

        If `backend` is specified, then a conversion between different backends
        might be triggered.

        If a library does not support lazy execution and `backend` is not specified,
        then this is will only restrict the API to lazy-only operations. This is useful
        if you want to ensure that you write dataframe-agnostic code which all has
        the possibility of running entirely lazily.

        Note:
            If `backend` is spark-like, then a valid `session` is required.

            For instance:

            ```py
            import narwhals as nw
            from sqlframe.duckdb import DuckDBSession

            df.lazy(backend=nw.Implementation.SQLFRAME, session=DuckDBSession())
            ```

        Arguments:
            backend: Which lazy backend collect to. This will be the underlying
                backend for the resulting Narwhals LazyFrame. If not specified, and the
                given library does not support lazy execution, then this will restrict
                the API to lazy-only operations.

                `backend` can be specified in various ways

                - As `Implementation.<BACKEND>` with `BACKEND` being `DASK`, `DUCKDB`,
                    `IBIS` or `POLARS`.
                - As a string: `"dask"`, `"duckdb"`, `"ibis"` or `"polars"`
                - Directly as a module `dask.dataframe`, `duckdb`, `ibis` or `polars`.
            session: Session to be used if backend is spark-like.

        Examples:
            >>> import polars as pl
            >>> import narwhals as nw
            >>> df_native = pl.DataFrame({"a": [1, 2], "b": [4, 6]})
            >>> df = nw.from_native(df_native)

            If we call `df.lazy`, we get a `narwhals.LazyFrame` backed by a Polars
            LazyFrame.

            >>> df.lazy()  # doctest: +SKIP
            ┌─────────────────────────────┐
            |     Narwhals LazyFrame      |
            |-----------------------------|
            |<LazyFrame at 0x7F52B9937230>|
            └─────────────────────────────┘

            We can also pass DuckDB as the backend, and then we'll get a
            `narwhals.LazyFrame` backed by a `duckdb.DuckDBPyRelation`.

            >>> df.lazy(backend=nw.Implementation.DUCKDB)
            ┌──────────────────┐
            |Narwhals LazyFrame|
            |------------------|
            |┌───────┬───────┐ |
            |│   a   │   b   │ |
            |│ int64 │ int64 │ |
            |├───────┼───────┤ |
            |│     1 │     4 │ |
            |│     2 │     6 │ |
            |└───────┴───────┘ |
            └──────────────────┘
        Nr  lazyrw   z(Not-supported backend.

Expected one of z or `None`, got )	rf   r  rV  r   r`  r$   r   r   r  )rn   rf  r  r  lazy_backendr   s         ro   r  zDataFrame.lazy  s    T $$))???4g#>f?MM%227;<(??4g#Ff?UU:8DT;U:VVfgsftuorq   c                .    | j                   j                  S )a  Convert Narwhals DataFrame to native one.

        Examples:
            >>> import pandas as pd
            >>> import narwhals as nw
            >>> df_native = pd.DataFrame(
            ...     {"foo": [1, 2, 3], "bar": [6.0, 7.0, 8.0], "ham": ["a", "b", "c"]}
            ... )

            Calling `to_native` on a Narwhals DataFrame returns the native object:

            >>> nw.from_native(df_native).to_native()
               foo  bar ham
            0    1  6.0   a
            1    2  7.0   b
            2    3  8.0   c
        )rf   r{  rm   s    ro   r7   zDataFrame.to_native  s    $ $$222rq   c                6    | j                   j                         S )a  Convert this DataFrame to a pandas DataFrame.

        Examples:
            >>> import polars as pl
            >>> import narwhals as nw
            >>> df_native = pl.DataFrame(
            ...     {"foo": [1, 2, 3], "bar": [6.0, 7.0, 8.0], "ham": ["a", "b", "c"]}
            ... )
            >>> df = nw.from_native(df_native)
            >>> df.to_pandas()
               foo  bar ham
            0    1  6.0   a
            1    2  7.0   b
            2    3  8.0   c
        )rf   	to_pandasrm   s    ro   r  zDataFrame.to_pandas3  s      $$..00rq   c                6    | j                   j                         S )u  Convert this DataFrame to a polars DataFrame.

        Examples:
            >>> import pyarrow as pa
            >>> import narwhals as nw
            >>> df_native = pa.table({"foo": [1, 2], "bar": [6.0, 7.0]})
            >>> df = nw.from_native(df_native)
            >>> df.to_polars()
            shape: (2, 2)
            ┌─────┬─────┐
            │ foo ┆ bar │
            │ --- ┆ --- │
            │ i64 ┆ f64 │
            ╞═════╪═════╡
            │ 1   ┆ 6.0 │
            │ 2   ┆ 7.0 │
            └─────┴─────┘
        )rf   	to_polarsrm   s    ro   r  zDataFrame.to_polarsE  s    & $$..00rq   c                     y rk   rl   rn   files     ro   	write_csvzDataFrame.write_csvZ  s    36rq   c                     y rk   rl   r  s     ro   r  zDataFrame.write_csv]  s    =@rq   c                8    | j                   j                  |      S )a  Write dataframe to comma-separated values (CSV) file.

        Arguments:
            file: String, path object or file-like object to which the dataframe will be
                written. If None, the resulting csv format is returned as a string.

        Examples:
            >>> import pandas as pd
            >>> import narwhals as nw
            >>> df_native = pd.DataFrame(
            ...     {"foo": [1, 2, 3], "bar": [6.0, 7.0, 8.0], "ham": ["a", "b", "c"]}
            ... )
            >>> df = nw.from_native(df_native)
            >>> df.write_csv()  # doctest: +SKIP
            'foo,bar,ham\n1,6.0,a\n2,7.0,b\n3,8.0,c\n'

            If we had passed a file name to `write_csv`, it would have been
            written to that file.
        )rf   r  r  s     ro   r  zDataFrame.write_csv`  s    ( $$..t44rq   c                :    | j                   j                  |       y)a  Write dataframe to parquet file.

        Arguments:
            file: String, path object or file-like object to which the dataframe will be
                written.

        Examples:
            >>> import pyarrow as pa
            >>> import narwhals as nw
            >>> df_native = pa.table({"foo": [1, 2], "bar": [6.0, 7.0]})
            >>> df = nw.from_native(df_native)
            >>> df.write_parquet("out.parquet")  # doctest:+SKIP
        N)rf   write_parquetr  s     ro   r  zDataFrame.write_parquetv  s     	++D1rq   c                <    | j                   j                  dd      S )ai  Convert this DataFrame to a NumPy ndarray.

        Examples:
            >>> import pandas as pd
            >>> import narwhals as nw
            >>> df_native = pd.DataFrame({"foo": [1, 2], "bar": [6.5, 7.0]})
            >>> df = nw.from_native(df_native)
            >>> df.to_numpy()
            array([[1. , 6.5],
                   [2. , 7. ]])
        Nrp  )rf   to_numpyrm   s    ro   r  zDataFrame.to_numpy  s      $$--d->>rq   c                .    | j                   j                  S )a  Get the shape of the DataFrame.

        Examples:
            >>> import pandas as pd
            >>> import narwhals as nw
            >>> df_native = pd.DataFrame({"foo": [1, 2]})
            >>> df = nw.from_native(df_native)
            >>> df.shape
            (2, 1)
        )rf   shaperm   s    ro   r  zDataFrame.shape  s     $$***rq   c                n    | j                  | j                  j                  |      | j                        S )a   Get a single column by name.

        Arguments:
            name: The column name as a string.

        Notes:
            Although `name` is typed as `str`, pandas does allow non-string column
            names, and they will work when passed to this function if the
            `narwhals.DataFrame` is backed by a pandas dataframe with non-string
            columns. This function can only be used to extract a column by name, so
            there is no risk of ambiguity.

        Examples:
            >>> import pandas as pd
            >>> import narwhals as nw
            >>> df_native = pd.DataFrame({"a": [1, 2]})
            >>> df = nw.from_native(df_native)
            >>> df.get_column("a").to_native()
            0    1
            1    2
            Name: a, dtype: int64
        rw   )rS  rf   
get_columnrh   )rn   r   s     ro   r  zDataFrame.get_column  s,    . ||D11<<TB$++|VVrq   c                :    | j                   j                  |      S )a;  Return an estimation of the total (heap) allocated size of the `DataFrame`.

        Estimated size is given in the specified unit (bytes by default).

        Arguments:
            unit: 'b', 'kb', 'mb', 'gb', 'tb', 'bytes', 'kilobytes', 'megabytes',
                'gigabytes', or 'terabytes'.

        Examples:
            >>> import pyarrow as pa
            >>> import narwhals as nw
            >>> df_native = pa.table({"foo": [1, 2], "bar": [6.0, 7.0]})
            >>> df = nw.from_native(df_native)
            >>> df.estimated_size()
            32
        )unit)rf   estimated_size)rn   r  s     ro   r  zDataFrame.estimated_size  s    " $$333>>rq   c                     y rk   rl   rn   items     ro   __getitem__zDataFrame.__getitem__  s    WZrq   c                     y rk   rl   r  s     ro   r  zDataFrame.__getitem__  s     rq   c                     y rk   rl   r  s     ro   r  zDataFrame.__getitem__  s     rq   c                   ddl m} dt        |       d}t        |t              r[t        |      dkD  rd}t        |      |rt        |d         rdn|d   }t        |      dk  st        |d         rdn|d   }|E|C| S t        |      r|}d}n1t        |      st        |t        t        f      rd}|}nt        |      t        |t              rt        |      | j                  }t        |t        t        f      r]t        |t              r| j                  ||      S t        |t              r|n| j                  |   }| j!                  |      }	||	|   S |	S t        ||      r|j"                  }t        ||      r|j"                  }|| j%                  |dd|f         S || j%                  ||ddf         S | j%                  |||f         S )	a	  Extract column or slice of DataFrame.

        Arguments:
            item: How to slice dataframe. What happens depends on what is passed. It's easiest
                to explain by example. Suppose we have a Dataframe `df`

                - `df['a']` extracts column `'a'` and returns a `Series`.
                - `df[0:2]` extracts the first two rows and returns a `DataFrame`.
                - `df[0:2, 'a']` extracts the first two rows from column `'a'` and returns
                    a `Series`.
                - `df[0:2, 0]` extracts the first two rows from the first column and returns
                    a `Series`.
                - `df[[0, 1], [0, 1, 2]]` extracts the first two rows and the first three columns
                    and returns a `DataFrame`
                - `df[:, [0, 1, 2]]` extracts all rows from the first three columns and returns a
                  `DataFrame`.
                - `df[:, ['a', 'c']]` extracts all rows and columns `'a'` and `'c'` and returns a
                  `DataFrame`.
                - `df[['a', 'c']]` extracts all rows and columns `'a'` and `'c'` and returns a
                  `DataFrame`.
                - `df[0: 2, ['a', 'c']]` extracts the first two rows and columns `'a'` and `'c'` and
                    returns a `DataFrame`
                - `df[:, 0: 2]` extracts all rows from the first two columns and returns a `DataFrame`
                - `df[:, 'a': 'c']` extracts all rows and all columns positioned between `'a'` and `'c'`
                    _inclusive_ and returns a `DataFrame`. For example, if the columns are
                    `'a', 'd', 'c', 'b'`, then that would extract columns `'a'`, `'d'`, and `'c'`.

        Notes:
            - Integers are always interpreted as positions
            - Strings are always interpreted as column names.

            In contrast with Polars, pandas allows non-string column names.
            If you don't know whether the column name you're trying to extract
            is definitely a string (e.g. `df[df.columns[0]]`) then you should
            use `DataFrame.get_column` instead.

        Examples:
            >>> import pandas as pd
            >>> import narwhals as nw
            >>> df_native = pd.DataFrame({"a": [1, 2]})
            >>> df = nw.from_native(df_native)
            >>> df["a"].to_native()
            0    1
            1    2
            Name: a, dtype: int64
        r   r4   z2Unexpected type for `DataFrame.__getitem__`, got: z.

Hints:
- use `df.item` to select a single item.
- Use `df[indices, :]` to select rows positionally.
- Use `df.filter(mask)` to filter rows based on a boolean mask.   zzTuples cannot be passed to DataFrame.__getitem__ directly.

Hint: instead of `df[indices]`, did you mean `df[indices, :]`?Nr   )narwhals.seriesr5   r   r   r   r   r   r'   r#   r&   slicer   rf   r7  r  r   r  _compliant_seriesr{   )
rn   r  r5   r   	tuple_msgrowsr   r  col_nameseriess
             ro   r  zDataFrame.__getitem__  s   v 	+ Ad MN N 	 dE"4y1}U   	**#}T!W'=447D!$i!m}T!W/Ed4PQ7G|t$DGd#z$'EDGC. dC C. ))	gSz*$$yyw//",Wc":wW@UH__X.F#'#36$<??dF#))Dgv&//G<''	!W*(=>>?''	$'(:;;##IdGm$<==rq   c                    || j                   v S rk   r(  )rn   keys     ro   __contains__zDataFrame.__contains__Q  s    dll""rq   .	as_seriesc                    y rk   rl   rn   r  s     ro   to_dictzDataFrame.to_dictT      TWrq   c                    y rk   rl   r  s     ro   r  zDataFrame.to_dictV  s    MPrq   Tc                    y rk   rl   r  s     ro   r  zDataFrame.to_dictX  s     9<rq   c          	         |rY| j                   j                  |      j                         D ci c]#  \  }}|| j                  || j                        % c}}S | j                   j                  |      S c c}}w )a)  Convert DataFrame to a dictionary mapping column name to values.

        Arguments:
            as_series: If set to true ``True``, then the values are Narwhals Series,
                    otherwise the values are Any.

        Examples:
            >>> import pyarrow as pa
            >>> import narwhals as nw
            >>> df_native = pa.table({"A": [1, 2], "fruits": ["banana", "apple"]})
            >>> df = nw.from_native(df_native)
            >>> df.to_dict(as_series=False)
            {'A': [1, 2], 'fruits': ['banana', 'apple']}
        r  rw   )rf   r  r   rS  rh   )rn   r  r  values       ro   r  zDataFrame.to_dict\  s    "  #'"7"7"?"?' #@ #%'	C T\\%t{{\;;  $$,,y,AAs   (A8c                8    | j                   j                  |      S )ak  Get values at given row.

        Warning:
            You should NEVER use this method to iterate over a DataFrame;
            if you require row-iteration you should strongly prefer use of iter_rows()
            instead.

        Arguments:
            index: Row number.

        Notes:
            cuDF doesn't support this method.

        Examples:
            >>> import pyarrow as pa
            >>> import narwhals as nw
            >>> df_native = pa.table({"a": [1, 2], "b": [4, 5]})
            >>> nw.from_native(df_native).row(1)
            (<pyarrow.Int64Scalar: 2>, <pyarrow.Int64Scalar: 5>)
        )rf   row)rn   r  s     ro   r  zDataFrame.rowv  s    * $$((//rq   c                *    t        |   |g|i |S )av  Pipe function call.

        Arguments:
            function: Function to apply.
            args: Positional arguments to pass to function.
            kwargs: Keyword arguments to pass to function.

        Examples:
            >>> import pandas as pd
            >>> import narwhals as nw
            >>> df_native = pd.DataFrame({"a": [1, 2], "ba": [4, 5]})
            >>> nw.from_native(df_native).pipe(
            ...     lambda _df: _df.select(
            ...         [x for x in _df.columns if len(x) == 1]
            ...     ).to_native()
            ... )
               a
            0  1
            1  2
        superr   rn   r   r   r   ry   s       ro   r   zDataFrame.pipe  s    4 w|H6t6v66rq   c                $    t         |   |      S )a  Drop rows that contain null values.

        Arguments:
            subset: Column name(s) for which null values are considered. If set to None
                (default), use all columns.

        Notes:
            pandas handles null values differently from Polars and PyArrow.
            See [null_handling](../concepts/null_handling.md)
            for reference.

        Examples:
            >>> import pyarrow as pa
            >>> import narwhals as nw
            >>> df_native = pa.table({"a": [1.0, None], "ba": [1.0, 2.0]})
            >>> nw.from_native(df_native).drop_nulls().to_native()
            pyarrow.Table
            a: double
            ba: double
            ----
            a: [[1]]
            ba: [[1]]
        r   r  r   rn   r   ry   s     ro   r   zDataFrame.drop_nulls  s    0 w!!00rq   order_byc                   t        |t              r|gn|}| j                  | j                  j	                  ||            S )av  Insert column which enumerates rows.

        Arguments:
            name: The name of the column as a string. The default is "index".
            order_by: Column(s) to order by when computing the row index.

        Examples:
            >>> import pyarrow as pa
            >>> import narwhals as nw
            >>> df_native = pa.table({"a": [1, 2], "b": [4, 5]})
            >>> nw.from_native(df_native).with_row_index().to_native()
            pyarrow.Table
            index: int64
            a: int64
            b: int64
            ----
            index: [[0,1]]
            a: [[1,2]]
            b: [[4,5]]
        r  r   r   r{   rf   with_row_indexrn   r   r  	order_by_s       ro   r  zDataFrame.with_row_index  sB    . #-Xs";XJ	##!!00	0J
 	
rq   c                    t         |   S )aN  Get an ordered mapping of column names to their data type.

        Examples:
            >>> import pyarrow as pa
            >>> import narwhals as nw
            >>> df_native = pa.table({"foo": [1, 2], "bar": [6.0, 7.0]})
            >>> nw.from_native(df_native).schema
            Schema({'foo': Int64, 'bar': Float64})
        )r  r   rn   ry   s    ro   r   zDataFrame.schema  s     w~rq   c                     t         |          S )aX  Get an ordered mapping of column names to their data type.

        Examples:
            >>> import pyarrow as pa
            >>> import narwhals as nw
            >>> df_native = pa.table({"foo": [1, 2], "bar": [6.0, 7.0]})
            >>> nw.from_native(df_native).collect_schema()
            Schema({'foo': Int64, 'bar': Float64})
        r  r   r  s    ro   r   zDataFrame.collect_schema       w%''rq   c                    t         |   S )a  Get column names.

        Examples:
            >>> import pyarrow as pa
            >>> import narwhals as nw
            >>> df_native = pa.table({"foo": [1, 2], "bar": [6.0, 7.0]})
            >>> nw.from_native(df_native).columns
            ['foo', 'bar']
        r  r   r  s    ro   r   zDataFrame.columns       wrq   Fnamedc                    y rk   rl   rn   r  s     ro   r  zDataFrame.rows  s    ORrq   c                    y rk   rl   r  s     ro   r  zDataFrame.rows	  s    EHrq   c                    y rk   rl   r  s     ro   r  zDataFrame.rows  r  rq   c               :    | j                   j                  |      S )a6  Returns all data in the DataFrame as a list of rows of python-native values.

        Arguments:
            named: By default, each row is returned as a tuple of values given
                in the same order as the frame columns. Setting named=True will
                return rows of dictionaries instead.

        Examples:
            >>> import pyarrow as pa
            >>> import narwhals as nw
            >>> df_native = pa.table({"foo": [1, 2], "bar": [6.0, 7.0]})
            >>> nw.from_native(df_native).rows()
            [(1, 6.0), (2, 7.0)]
        r  )rf   r  r  s     ro   r  zDataFrame.rows  s    " $$)))66rq   c              #     K   | j                   j                         D ]!  }| j                  || j                         # yw)u  Returns an iterator over the columns of this DataFrame.

        Yields:
            A Narwhals Series, backed by a native series.

        Examples:
            >>> import pandas as pd
            >>> import narwhals as nw
            >>> df_native = pd.DataFrame({"foo": [1, 2], "bar": [6.0, 7.0]})
            >>> iter_columns = nw.from_native(df_native).iter_columns()
            >>> next(iter_columns)
            ┌───────────────────────┐
            |    Narwhals Series    |
            |-----------------------|
            |0    1                 |
            |1    2                 |
            |Name: foo, dtype: int64|
            └───────────────────────┘
            >>> next(iter_columns)
            ┌─────────────────────────┐
            |     Narwhals Series     |
            |-------------------------|
            |0    6.0                 |
            |1    7.0                 |
            |Name: bar, dtype: float64|
            └─────────────────────────┘
        rw   N)rf   iter_columnsrS  rh   )rn   r  s     ro   r  zDataFrame.iter_columns"  s=     8 ++88: 	:F,,vT[[,99	:s   A Ar  buffer_sizec                    y rk   rl   rn   r  r  s      ro   	iter_rowszDataFrame.iter_rowsA  s     %(rq   )r  c                    y rk   rl   r  s      ro   r  zDataFrame.iter_rowsF  s     $'rq   c                    y rk   rl   r  s      ro   r  zDataFrame.iter_rowsK  s	     @Crq   i   c               <    | j                   j                  ||      S )a  Returns an iterator over the DataFrame of rows of python-native values.

        Arguments:
            named: By default, each row is returned as a tuple of values given
                in the same order as the frame columns. Setting named=True will
                return rows of dictionaries instead.
            buffer_size: Determines the number of rows that are buffered
                internally while iterating over the data.
                See https://docs.pola.rs/api/python/stable/reference/dataframe/api/polars.DataFrame.iter_rows.html

        Notes:
            cuDF doesn't support this method.

        Examples:
            >>> import pyarrow as pa
            >>> import narwhals as nw
            >>> df_native = pa.table({"foo": [1, 2], "bar": [6.0, 7.0]})
            >>> iter_rows = nw.from_native(df_native).iter_rows()
            >>> next(iter_rows)
            (1, 6.0)
            >>> next(iter_rows)
            (2, 7.0)
        r  )rf   r  r  s      ro   r  zDataFrame.iter_rowsP  s     4 $$..U.TTrq   c                "    t        |   |i |S )a8  Add columns to this DataFrame.

        Added columns will replace existing columns with the same name.

        Arguments:
            *exprs: Column(s) to add, specified as positional arguments.
                     Accepts expression input. Strings are parsed as column names, other
                     non-expression inputs are parsed as literals.

            **named_exprs: Additional columns to add, specified as keyword arguments.
                            The columns will be renamed to the keyword used.

        Note:
            Creating a new DataFrame using this method does not create a new copy of
            existing data.

        Examples:
            >>> import pandas as pd
            >>> import narwhals as nw
            >>> df_native = pd.DataFrame({"a": [1, 2], "b": [0.5, 4.0]})
            >>> (
            ...     nw.from_native(df_native)
            ...     .with_columns((nw.col("a") * 2).alias("a*2"))
            ...     .to_native()
            ... )
               a    b  a*2
            0  1  0.5    2
            1  2  4.0    4
        )r  r   rn   r   r   ry   s      ro   r   zDataFrame.with_columnsl  s    @ w#U:k::rq   c                "    t        |   |i |S )uX  Select columns from this DataFrame.

        Arguments:
            *exprs: Column(s) to select, specified as positional arguments.
                     Accepts expression input. Strings are parsed as column names,
                     other non-expression inputs are parsed as literals.

            **named_exprs: Additional columns to select, specified as keyword arguments.
                            The columns will be renamed to the keyword used.

        Examples:
            >>> import pyarrow as pa
            >>> import narwhals as nw
            >>> df_native = pa.table({"a": [1, 2], "b": [3, 4]})
            >>> nw.from_native(df_native).select("a", a_plus_1=nw.col("a") + 1)
            ┌──────────────────┐
            |Narwhals DataFrame|
            |------------------|
            |pyarrow.Table     |
            |a: int64          |
            |a_plus_1: int64   |
            |----              |
            |a: [[1,2]]        |
            |a_plus_1: [[2,3]] |
            └──────────────────┘
        )r  r   r  s      ro   r   zDataFrame.select  s    : w~u444rq   c                "    t         |   |      S )a  Rename column names.

        Arguments:
            mapping: Key value pairs that map from old name to new name.

        Examples:
            >>> import pyarrow as pa
            >>> import narwhals as nw
            >>> df_native = pa.table({"foo": [1, 2], "bar": [6, 7]})
            >>> nw.from_native(df_native).rename({"foo": "apple"}).to_native()
            pyarrow.Table
            apple: int64
            bar: int64
            ----
            apple: [[1,2]]
            bar: [[6,7]]
        r  r   rn   r   ry   s     ro   r   zDataFrame.rename  s    $ w~g&&rq   c                "    t         |   |      S )a  Get the first `n` rows.

        Arguments:
            n: Number of rows to return. If a negative value is passed, return all rows
                except the last `abs(n)`.

        Examples:
            >>> import pandas as pd
            >>> import narwhals as nw
            >>> df_native = pd.DataFrame({"a": [1, 2], "b": [0.5, 4.0]})
            >>> nw.from_native(df_native).head(1).to_native()
               a    b
            0  1  0.5
        r  r   rn   r   ry   s     ro   r   zDataFrame.head  s     w|Arq   c                "    t         |   |      S )u  Get the last `n` rows.

        Arguments:
            n: Number of rows to return. If a negative value is passed, return all rows
                except the first `abs(n)`.

        Examples:
            >>> import pandas as pd
            >>> import narwhals as nw
            >>> df_native = pd.DataFrame({"a": [1, 2], "b": [0.5, 4.0]})
            >>> nw.from_native(df_native).tail(1)
            ┌──────────────────┐
            |Narwhals DataFrame|
            |------------------|
            |       a    b     |
            |    1  2  4.0     |
            └──────────────────┘
        )r  r   r  s     ro   r   zDataFrame.tail      & w|Arq   r   c               4    t        |   t        |      d|iS )a  Remove columns from the dataframe.

        Arguments:
            *columns: Names of the columns that should be removed from the dataframe.
            strict: Validate that all column names exist in the schema and throw an
                exception if a column name does not exist in the schema.

        Examples:
            >>> import pandas as pd
            >>> import narwhals as nw
            >>> df_native = pd.DataFrame(
            ...     {"foo": [1, 2], "bar": [6.0, 7.0], "ham": ["a", "b"]}
            ... )
            >>> nw.from_native(df_native).drop("ham").to_native()
               foo  bar
            0    1  6.0
            1    2  7.0
        r   r  r   r   rn   r   r   ry   s      ro   r   zDataFrame.drop  s    & w|WW-=f==rq   anykeepmaintain_orderr  c                   |dvrdd d| }t        |      t        |t              r|g}| j                  | j                  j                  ||||            S )aJ  Drop duplicate rows from this dataframe.

        Arguments:
            subset: Column name(s) to consider when identifying duplicate rows.
            keep: {'first', 'last', 'any', 'none'}
                Which of the duplicate rows to keep.

                * 'any': Does not give any guarantee of which row is kept.
                        This allows more optimizations.
                * 'none': Don't keep duplicate rows.
                * 'first': Keep first unique row.
                * 'last': Keep last unique row.
            maintain_order: Keep the same order as the original DataFrame. This may be more
                expensive to compute.
            order_by: Column(s) to order by when computing the row index.

        Examples:
            >>> import pandas as pd
            >>> import narwhals as nw
            >>> df_native = pd.DataFrame(
            ...     {"foo": [1, 2], "bar": ["a", "a"], "ham": ["b", "b"]}
            ... )
            >>> nw.from_native(df_native).unique(["bar", "ham"]).to_native()
               foo bar ham
            0    1   a   b
        >   r  lastnonefirst	Expected r  r  r  r  r   r  )r  r   r   r{   rf   unique)rn   r   r  r  r  r   s         ro   r  zDataFrame.unique  sr    D 77<=WTFKCS/!fc"XF##!!((T.8 ) 
 	
rq   c                "    t        |   |i |S )a  Filter the rows in the DataFrame based on one or more predicate expressions.

        The original order of the remaining rows is preserved.

        Arguments:
            *predicates: Expression(s) that evaluates to a boolean Series. Can
                also be a (single!) boolean list.
            **constraints: Column filters; use `name = value` to filter columns by the supplied value.
                Each constraint will behave the same as `nw.col(name).eq(value)`, and will be implicitly
                joined with the other filter conditions using &.

        Examples:
            >>> import pandas as pd
            >>> import narwhals as nw
            >>> df_native = pd.DataFrame(
            ...     {"foo": [1, 2, 3], "bar": [6, 7, 8], "ham": ["a", "b", "c"]}
            ... )

            Filter on one condition

            >>> nw.from_native(df_native).filter(nw.col("foo") > 1).to_native()
               foo  bar ham
            1    2    7   b
            2    3    8   c

            Filter on multiple conditions with implicit `&`

            >>> nw.from_native(df_native).filter(
            ...     nw.col("foo") < 3, nw.col("ham") == "a"
            ... ).to_native()
               foo  bar ham
            0    1    6   a

            Filter on multiple conditions with `|`

            >>> nw.from_native(df_native).filter(
            ...     (nw.col("foo") == 1) | (nw.col("ham") == "c")
            ... ).to_native()
               foo  bar ham
            0    1    6   a
            2    3    8   c

            Filter using `**kwargs` syntax

            >>> nw.from_native(df_native).filter(foo=2, ham="b").to_native()
               foo  bar ham
            1    2    7   b
        )r  r   )rn   r   r   ry   s      ro   r   zDataFrame.filter)  s    f w~z9[99rq   drop_null_keysc                    y rk   rl   rn   r  keyss      ro   group_byzDataFrame.group_by^       rq   c                    y rk   rl   r  s      ro   r  zDataFrame.group_byc  r  rq   c                  ddl m} t        |      }t        d |D              r || ||      S ddlm} ddlm ddlm	 t        fd|D              }|rt        |      rd	}t        |      t        ||      D 	cg c]  \  }}	|	r|n ||       }
}}	 | j                  |
 \  }}t        d
 |D              sddlm} d} ||       || ||      S c c}	}w )a  Start a group by operation.

        Arguments:
            *keys: Column(s) to group by. Accepts expression input. Strings are parsed as
                column names.
            drop_null_keys: if True, then groups where any key is null won't be included
                in the result.

        Examples:
            >>> import pandas as pd
            >>> import narwhals as nw
            >>> df_native = pd.DataFrame(
            ...     {
            ...         "a": ["a", "b", "a", "b", "c"],
            ...         "b": [1, 2, 1, 3, 3],
            ...         "c": [5, 4, 3, 2, 1],
            ...     }
            ... )

            Group by one column and compute the sum of another column

            >>> nw.from_native(df_native, eager_only=True).group_by("a").agg(
            ...     nw.col("b").sum()
            ... ).sort("a").to_native()
               a  b
            0  a  2
            1  b  5
            2  c  3

            Group by multiple columns and compute the max of another column

            >>> (
            ...     nw.from_native(df_native, eager_only=True)
            ...     .group_by(["a", "b"])
            ...     .agg(nw.max("c"))
            ...     .sort("a", "b")
            ...     .to_native()
            ... )
               a  b  c
            0  a  1  5
            1  b  2  4
            2  b  3  2
            3  c  3  1

            Expressions are also accepted.

            >>> nw.from_native(df_native, eager_only=True).group_by(
            ...     "a", nw.col("b") // 2
            ... ).agg(nw.col("c").mean()).to_native()
               a  b    c
            0  a  0  4.0
            1  b  1  3.0
            2  c  1  1.0
        r   )rL   c              3  <   K   | ]  }t        |t                y wrk   r   r   r  s     ro   r   z%DataFrame.group_by.<locals>.<genexpr>       9z#s#9r   r  r   Exprr4   c              3  :   K   | ]  }t        |f        y wrk   r   )r   r   r  r5   s     ro   r   z%DataFrame.group_by.<locals>.<genexpr>  s     %WjT6N&C%Ws   z?drop_null_keys cannot be True when keys contains Expr or Seriesc              3  @   K   | ]  }|t         j                  u   y wrk   r   ELEMENTWISEr   s     ro   r   z%DataFrame.group_by.<locals>.<genexpr>       BD48///B   ComputeErrorHGroup by is not supported with keys that are not elementwise expressions)narwhals.group_byrL   r   r   narwhalsr   narwhals.exprr  r  r5   r   r  r   r*   r   narwhals.exceptionsr  )rn   r  r  rL   	flat_keysr   key_is_expr_or_seriesr   r   is_expr_keysexpr_flat_keysr   r  r  r5   s                 @@ro   r  zDataFrame.group_byh  s    r 	.DM	9y994>JJ &* %%WY%W Wc"78SC%c** )4IJ
7 Ac!f$
 
 !: 9 95 ABEBB8 [  s##t^NKK
s   Cr   c               ,    t        |   |g|||dS )u  Sort the dataframe by the given columns.

        Arguments:
            by: Column(s) names to sort by.
            *more_by: Additional columns to sort by, specified as positional arguments.
            descending: Sort in descending order. When sorting by multiple columns, can be
                specified per column by passing a sequence of booleans.
            nulls_last: Place null values last.

        Note:
            Unlike Polars, it is not possible to specify a sequence of booleans for
            `nulls_last` in order to control per-column behaviour. Instead a single
            boolean is applied for all `by` columns.

        Examples:
            >>> import pandas as pd
            >>> import narwhals as nw
            >>> df_native = pd.DataFrame(
            ...     {"foo": [2, 1], "bar": [6.0, 7.0], "ham": ["a", "b"]}
            ... )
            >>> nw.from_native(df_native).sort("foo")
            ┌──────────────────┐
            |Narwhals DataFrame|
            |------------------|
            |    foo  bar ham  |
            | 1    1  7.0   b  |
            | 0    2  6.0   a  |
            └──────────────────┘
        r   r  r   rn   r   r   r   r   ry   s        ro   r   zDataFrame.sort  s!    H w|BWWZJWWrq   r   c               (    t         |   |||      S )ux  Return the `k` largest rows.

        Non-null elements are always preferred over null elements,
        regardless of the value of reverse. The output is not guaranteed
        to be in any particular order, sort the outputs afterwards if you wish the output to be sorted.

        Arguments:
            k: Number of rows to return.
            by: Column(s) used to determine the top rows. Accepts expression input. Strings are parsed as column names.
            reverse: Consider the k smallest elements of the by column(s) (instead of the k largest).
                This can be specified per column by passing a sequence of booleans.

        Returns:
            The dataframe with the `k` largest rows.

        Examples:
            >>> import pandas as pd
            >>> import narwhals as nw
            >>> df_native = pd.DataFrame(
            ...     {"a": ["a", "b", "a", "b", None, "c"], "b": [2, 1, 1, 3, 2, 1]}
            ... )
            >>> nw.from_native(df_native).top_k(4, by=["b", "a"])
            ┌──────────────────┐
            |Narwhals DataFrame|
            |------------------|
            |          a  b    |
            |    3     b  3    |
            |    0     a  2    |
            |    4  None  2    |
            |    5     c  1    |
            └──────────────────┘
        r   r  r   rn   r   r   r   ry   s       ro   r   zDataFrame.top_k  s    F w}Q2w}77rq   _rightr  r  r  c               .    t         |   ||||||      S )u|  Join in SQL-like fashion.

        Arguments:
            other: DataFrame to join with.
            on: Name(s) of the join columns in both DataFrames. If set, `left_on` and
                `right_on` should be None.
            how: Join strategy.

                  * *inner*: Returns rows that have matching values in both tables.
                  * *left*: Returns all rows from the left table, and the matched rows from the right table.
                  * *full*: Returns all rows in both dataframes, with the suffix appended to the right join keys.
                  * *cross*: Returns the Cartesian product of rows from both tables.
                  * *semi*: Filter rows that have a match in the right table.
                  * *anti*: Filter rows that do not have a match in the right table.
            left_on: Join column of the left DataFrame.
            right_on: Join column of the right DataFrame.
            suffix: Suffix to append to columns with a duplicate name.

        Examples:
            >>> import pandas as pd
            >>> import narwhals as nw
            >>> df_1_native = pd.DataFrame({"id": ["a", "b"], "price": [6.0, 7.0]})
            >>> df_2_native = pd.DataFrame({"id": ["a", "b", "c"], "qty": [1, 2, 3]})
            >>> nw.from_native(df_1_native).join(nw.from_native(df_2_native), on="id")
            ┌──────────────────┐
            |Narwhals DataFrame|
            |------------------|
            |   id  price  qty |
            | 0  a    6.0    1 |
            | 1  b    7.0    2 |
            └──────────────────┘
        r  r  r  r
  r  r  r	  rn   r   r
  r  r  r  r  ry   s          ro   r	  zDataFrame.join  s)    T w|sGh2f  
 	
rq   r  r  r  r
  r  r  r   r  r  c               4    t         
|   |||||||||		      S )u;  Perform an asof join.

        This is similar to a left-join except that we match on nearest key rather than equal keys.

        For Polars, both DataFrames must be sorted by the `on` key (within each `by` group
        if specified).

        Arguments:
            other: DataFrame to join with.
            left_on: Name(s) of the left join column(s).
            right_on: Name(s) of the right join column(s).
            on: Join column of both DataFrames. If set, left_on and right_on should be None.
            by_left: join on these columns before doing asof join.
            by_right: join on these columns before doing asof join.
            by: join on these columns before doing asof join.
            strategy: Join strategy. The default is "backward".
            suffix: Suffix to append to columns with a duplicate name.

                  * *backward*: selects the last row in the right DataFrame whose "on" key is less than or equal to the left's key.
                  * *forward*: selects the first row in the right DataFrame whose "on" key is greater than or equal to the left's key.
                  * *nearest*: search selects the last row in the right DataFrame whose value is nearest to the left's key.

        Examples:
            >>> from datetime import datetime
            >>> import pandas as pd
            >>> import narwhals as nw
            >>> data_gdp = {
            ...     "datetime": [
            ...         datetime(2016, 1, 1),
            ...         datetime(2017, 1, 1),
            ...         datetime(2018, 1, 1),
            ...         datetime(2019, 1, 1),
            ...         datetime(2020, 1, 1),
            ...     ],
            ...     "gdp": [4164, 4411, 4566, 4696, 4827],
            ... }
            >>> data_population = {
            ...     "datetime": [
            ...         datetime(2016, 3, 1),
            ...         datetime(2018, 8, 1),
            ...         datetime(2019, 1, 1),
            ...     ],
            ...     "population": [82.19, 82.66, 83.12],
            ... }
            >>> gdp_native = pd.DataFrame(data_gdp)
            >>> population_native = pd.DataFrame(data_population)
            >>> gdp = nw.from_native(gdp_native)
            >>> population = nw.from_native(population_native)
            >>> population.join_asof(gdp, on="datetime", strategy="backward")
            ┌──────────────────────────────┐
            |      Narwhals DataFrame      |
            |------------------------------|
            |    datetime  population   gdp|
            |0 2016-03-01       82.19  4164|
            |1 2018-08-01       82.66  4566|
            |2 2019-01-01       83.12  4696|
            └──────────────────────────────┘
        r+  r  r  rn   r   r  r  r
  r  r  r   r  r  ry   s             ro   r  zDataFrame.join_asof;  s8    N w  ! 

 
	
rq   c                $    | j                          S )u]  Get a mask of all duplicated rows in this DataFrame.

        Examples:
            >>> import pandas as pd
            >>> import narwhals as nw
            >>> df_native = pd.DataFrame({"foo": [2, 2, 2], "bar": [6.0, 6.0, 7.0]})
            >>> nw.from_native(df_native).is_duplicated()
            ┌───────────────┐
            |Narwhals Series|
            |---------------|
            |  0     True   |
            |  1     True   |
            |  2    False   |
            |  dtype: bool  |
            └───────────────┘
        )	is_uniquerm   s    ro   is_duplicatedzDataFrame.is_duplicated  s    "    rq   c                    t        |       dk(  S )a"  Check if the dataframe is empty.

        Examples:
            >>> import pandas as pd
            >>> import narwhals as nw
            >>> df_native = pd.DataFrame({"foo": [2, 2, 2], "bar": [6.0, 6.0, 7.0]})
            >>> nw.from_native(df_native).is_empty()
            False
        r   )r   rm   s    ro   is_emptyzDataFrame.is_empty  s     4yA~rq   c                l    | j                  | j                  j                         | j                        S )uU  Get a mask of all unique rows in this DataFrame.

        Examples:
            >>> import pandas as pd
            >>> import narwhals as nw
            >>> df_native = pd.DataFrame({"foo": [2, 2, 2], "bar": [6.0, 6.0, 7.0]})
            >>> nw.from_native(df_native).is_unique()
            ┌───────────────┐
            |Narwhals Series|
            |---------------|
            |  0    False   |
            |  1    False   |
            |  2     True   |
            |  dtype: bool  |
            └───────────────┘
        rw   )rS  rf   r0  rh   rm   s    ro   r0  zDataFrame.is_unique  s*    " ||D11;;=T[[|QQrq   c                    | j                   j                         }| j                   j                  |j                         j	                               }| j                  |      S )ug  Create a new DataFrame that shows the null counts per column.

        Notes:
            pandas handles null values differently from Polars and PyArrow.
            See [null_handling](../concepts/null_handling.md/) for reference.

        Examples:
            >>> import pyarrow as pa
            >>> import narwhals as nw
            >>> df_native = pa.table({"foo": [1, None], "bar": [2, 3]})
            >>> nw.from_native(df_native).null_count()
            ┌──────────────────┐
            |Narwhals DataFrame|
            |------------------|
            |  pyarrow.Table   |
            |  foo: int64      |
            |  bar: int64      |
            |  ----            |
            |  foo: [[1]]      |
            |  bar: [[0]]      |
            └──────────────────┘
        )rf   ru   r   r   
null_countr{   )rn   r   r  s      ro   r6  zDataFrame.null_count  sN    . ##::<&&--cggi.B.B.DE##F++rq   c                <    | j                   j                  ||      S )a  Return the DataFrame as a scalar, or return the element at the given row/column.

        Arguments:
            row: The *n*-th row.
            column: The column selected via an integer or a string (column name).

        Notes:
            If row/col not provided, this is equivalent to df[0,0], with a check that the shape is (1,1).
            With row/col, this is equivalent to df[row,col].

        Examples:
            >>> import pyarrow as pa
            >>> import narwhals as nw
            >>> df_native = pa.table({"foo": [1, None], "bar": [2, 3]})
            >>> nw.from_native(df_native).item(0, 1)
            2
        )r  column)rf   r  )rn   r  r8  s      ro   r  zDataFrame.item  s     $ $$))c&)AArq   c                T    | j                  | j                  j                               S )z Create a copy of this DataFrame.)r{   rf   clonerm   s    ro   r:  zDataFrame.clone  s"    ##D$9$9$?$?$ABBrq   c                &    t         |   ||      S )u  Take every nth row in the DataFrame and return as a new DataFrame.

        Arguments:
            n: Gather every *n*-th row.
            offset: Starting index.

        Examples:
            >>> import pyarrow as pa
            >>> import narwhals as nw
            >>> df_native = pa.table({"foo": [1, None, 2, 3]})
            >>> nw.from_native(df_native).gather_every(2)
            ┌──────────────────┐
            |Narwhals DataFrame|
            |------------------|
            |  pyarrow.Table   |
            |  foo: int64      |
            |  ----            |
            |  foo: [[1,2]]    |
            └──────────────────┘
        r  )r  r  )rn   r   r  ry   s      ro   r  zDataFrame.gather_every  s    * w#a#77rq   _)r  valuesaggregate_functionr  sort_columns	separatorc          
     *   ||d}t        |      |d}t        |t               t        |t              r|gn|}t        |t              r|gn|}t        |t              r|gn|}| j                  | j                  j                  ||||||            S )u  Create a spreadsheet-style pivot table as a DataFrame.

        Arguments:
            on: Name of the column(s) whose values will be used as the header of the
                output DataFrame.
            index: One or multiple keys to group by. If None, all remaining columns not
                specified on `on` and `values` will be used. At least one of `index` and
                `values` must be specified.
            values: One or multiple keys to group by. If None, all remaining columns not
                specified on `on` and `index` will be used. At least one of `index` and
                `values` must be specified.
            aggregate_function: Choose from

                - None: no aggregation takes place, will raise error if multiple values
                    are in group.
                - A predefined aggregate function string, one of
                    {'min', 'max', 'first', 'last', 'sum', 'mean', 'median', 'len'}
            maintain_order: Has no effect and is kept around only for backwards-compatibility.
            sort_columns: Sort the transposed columns by name. Default is by order of
                discovery.
            separator: Used as separator/delimiter in generated column names in case of
                multiple `values` columns.

        Examples:
            >>> import pandas as pd
            >>> import narwhals as nw
            >>> data = {
            ...     "ix": [1, 1, 2, 2, 1, 2],
            ...     "col": ["a", "a", "a", "a", "b", "b"],
            ...     "foo": [0, 1, 2, 2, 7, 1],
            ...     "bar": [0, 2, 0, 0, 9, 4],
            ... }
            >>> df_native = pd.DataFrame(data)
            >>> nw.from_native(df_native).pivot(
            ...     "col", index="ix", aggregate_function="sum"
            ... )
            ┌─────────────────────────────────┐
            |       Narwhals DataFrame        |
            |---------------------------------|
            |   ix  foo_a  foo_b  bar_a  bar_b|
            |0   1      1      7      2      9|
            |1   2      4      1      0      4|
            └─────────────────────────────────┘
        z3At least one of `values` and `index` must be passedzx`maintain_order` has no effect and is only kept around for backwards-compatibility. You can safely remove this argument.)r
  r  r=  r>  r?  r@  )r  r   UserWarningr   r   r{   rf   pivot)	rn   r
  r  r=  r>  r  r?  r@  r   s	            ro   rC  zDataFrame.pivot  s    n >emGCS/!%7  #{+C(bTb'4&&%eS1u##!!''#5)# ( 	
 		
rq   c                6    | j                   j                         S )a  Convert to arrow table.

        Examples:
            >>> import pandas as pd
            >>> import narwhals as nw
            >>> df_native = pd.DataFrame({"foo": [1, None], "bar": [2, 3]})
            >>> nw.from_native(df_native).to_arrow()
            pyarrow.Table
            foo: double
            bar: int64
            ----
            foo: [[1,null]]
            bar: [[2,3]]
        )rf   r  rm   s    ro   r  zDataFrame.to_arrowZ  s     $$--//rq   )fractionwith_replacementseedc               ^    | j                  | j                  j                  ||||            S )u'  Sample from this DataFrame.

        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.

        Notes:
            The results may not be consistent across libraries.

        Examples:
            >>> import pandas as pd
            >>> import narwhals as nw
            >>> df_native = pd.DataFrame({"foo": [1, 2, 3], "bar": [19, 32, 4]})
            >>> nw.from_native(df_native).sample(n=2)  # doctest:+SKIP
            ┌──────────────────┐
            |Narwhals DataFrame|
            |------------------|
            |      foo  bar    |
            |   2    3    4    |
            |   1    2   32    |
            └──────────────────┘
        )r   rE  rF  rG  )r{   rf   sample)rn   r   rE  rF  rG  s        ro   rI  zDataFrame.samplek  s<    B ##!!((h9IPT ) 
 	
rq   variabler  r  r  r   c               *    t         |   ||||      S )u$  Unpivot a DataFrame from wide to long format.

        Optionally leaves identifiers set.

        This function is useful to massage a DataFrame into a format where one or more
        columns are identifier variables (index) while all other columns, considered
        measured variables (on), are "unpivoted" to the row axis leaving just
        two non-identifier columns, 'variable' and 'value'.

        Arguments:
            on: Column(s) to use as values variables; if `on` is empty all columns that
                are not in `index` will be used.
            index: Column(s) to use as identifier variables.
            variable_name: Name to give to the `variable` column. Defaults to "variable".
            value_name: Name to give to the `value` column. Defaults to "value".

        Notes:
            If you're coming from pandas, this is similar to `pandas.DataFrame.melt`,
            but with `index` replacing `id_vars` and `on` replacing `value_vars`.
            In other frameworks, you might know this operation as `pivot_longer`.

        Examples:
            >>> import pandas as pd
            >>> import narwhals as nw
            >>> data = {"a": ["x", "y", "z"], "b": [1, 3, 5], "c": [2, 4, 6]}
            >>> df_native = pd.DataFrame(data)
            >>> nw.from_native(df_native).unpivot(["b", "c"], index="a")
            ┌────────────────────┐
            | Narwhals DataFrame |
            |--------------------|
            |   a variable  value|
            |0  x        b      1|
            |1  y        b      3|
            |2  z        b      5|
            |3  x        c      2|
            |4  y        c      4|
            |5  z        c      6|
            └────────────────────┘
        r  r  r!  rn   r
  r  r  r   ry   s        ro   r!  zDataFrame.unpivot  s%    ^ wm
  
 	
rq   c                $    t        |   |g| S )u?  Explode the dataframe to long format by exploding the given columns.

        Notes:
            It is possible to explode multiple columns only if these columns must have
            matching element counts.

        Arguments:
            columns: Column names. The underlying columns being exploded must be of the `List` data type.
            *more_columns: Additional names of columns to explode, specified as positional arguments.

        Examples:
            >>> import polars as pl
            >>> import narwhals as nw
            >>> data = {"a": ["x", "y"], "b": [[1, 2], [3]]}
            >>> df_native = pl.DataFrame(data)
            >>> nw.from_native(df_native).explode("b").to_native()
            shape: (3, 2)
            ┌─────┬─────┐
            │ a   ┆ b   │
            │ --- ┆ --- │
            │ str ┆ i64 │
            ╞═════╪═════╡
            │ x   ┆ 1   │
            │ x   ┆ 2   │
            │ y   ┆ 3   │
            └─────┴─────┘
        r  r)  rn   r   r*  ry   s      ro   r)  zDataFrame.explode  s    8 ww666rq   )r,  z.CompliantDataFrame[Any, Any, DataFrameT, Self]r.  )r,  ztype[Series[Any]])r,  ztype[LazyFrame[Any]]rz   r   rx   rg   r,  None)re  rG   rf  IntoBackend[EagerAllowed]r,  DataFrame[Any]rk   )rj  zMapping[str, Any]r   zIntoSchema | Nonerf  z IntoBackend[EagerAllowed] | Noner,  rU  )rj  r\   r   z!IntoSchema | Sequence[str] | Nonerf  rT  r,  rU  )r,  r7  )NN)rs  r   rq  bool | Noner,  r\   r,  r   )ry  zobject | Noner,  rA  )rf  zIntoBackend[LazyAllowed] | Noner  z
Any | Noner,  zLazyFrame[Any])r,  rb   )r,  zpd.DataFrame)r,  zpl.DataFrame)r  rS  r,  r   r  zstr | Path | BytesIOr,  rS  )r  zstr | Path | BytesIO | Noner,  r?  )r,  r\   )r,  ztuple[int, int])r   r   r,  Series[Any])b)r  rZ   r,  zint | float)r  z-tuple[SingleIndexSelector, SingleColSelector]r,  r   )r  z2str | tuple[MultiIndexSelector, SingleColSelector]r,  rY  )r  zSingleIndexSelector | MultiIndexSelector | MultiColSelector | tuple[SingleIndexSelector, MultiColSelector] | tuple[MultiIndexSelector, MultiColSelector]r,  rA   )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  r   r,  r   )r  Literal[True]r,  zdict[str, Series[Any]])r  Literal[False]r,  zdict[str, list[Any]])r  r   r,  z-dict[str, Series[Any]] | dict[str, list[Any]])r  r7  r,  ztuple[Any, ...]r0  r1  r  )r   r   r  str | Sequence[str] | Noner,  rA   r/  r3  )r  r\  r,  zlist[tuple[Any, ...]])r  r[  r,  zlist[dict[str, Any]])r  r   r,  z,list[tuple[Any, ...]] | list[dict[str, Any]])r,  zIterator[Series[Any]])r  r\  r  r7  r,  zIterator[tuple[Any, ...]])r  r[  r  r7  r,  zIterator[dict[str, Any]])r  r   r  r7  r,  z4Iterator[tuple[Any, ...]] | Iterator[dict[str, Any]]r4  r5     r6  r   r:  r   r   r,  rA   )
r   r2  r  r[   r  r   r  r^  r,  rA   r8  )r  r-  r  r\  r,  GroupBy[Self])r  r:  r  r[  r,  rb  )r  r-  r  r   r,  rb  r9  r<  Nr   r   rA   r
  r2  r  rT   r  r2  r  r2  r  r   r,  rA   r   rA   r  r?  r  r?  r
  r?  r  r2  r  r2  r   r2  r  rN   r  r   r,  rA   )r,  rY  )r,  r   r,  rA   )r  
int | Noner8  zint | str | Noner,  r   r=  r>  )r
  zstr | list[str]r  r2  r=  r2  r>  zPivotAgg | Noner  rV  r?  r   r@  r   r,  rA   )r,  zpa.Table)
r   rg  rE  zfloat | NonerF  r   rG  rg  r,  rA   r@  rB  )HrD  rE  rF  __doc__r   MAINrK  rG  rH  rp   r   rS  rV  r\  classmethodrc  ri  rl  rn  rr  rv  r|  r  r7   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	  r  r1  r3  r0  r6  r  r:  r  rC  r  rI  r!  r)  __classcell__ry   s   @ro   rJ  rJ    s   0 #*,,H.% %@    & 2)27P2	2 2h  %)8
 5988 "8
 28 
8 8t  59DD 2D
 +D 
D DL/APN2 48Q #	Q0Q 	Q
 
Qf3(1$1* 6 6@ @5,2 ? + +W2?* Z ZF	  	:	 
	 	l>:l> 
"l>\# 47W WP P#'< <	6< < $(B B	6B400747 7 	7
 
7816 "
MQ

0J
	
8 
 

( 
 
 .3R RH HW W  %77	57&:> ),(&(;>(	"( ( :='%'47'	!' ' 14CC+.C	=C C
  %UU36U	=U8 ;3 ;DL ;	 ;D535DL5	5>'("* BF >. *.+
 $)$/3+
&+
 !	+

 +
 -+
 
+
Z3:E3:VY3:	3:j UX2DR	  (:G	 
 LQXL2XLDHXL	XL| -2 $X$X $X *	$X
 $X 
$XN TY#8#80#8;P#8	#8P &*#	,
 +/+/,
,
 #,
 	,
 (,
 ),
 ,
 
,
d ##*.+/%)%/Q
Q
 	Q

 Q
 Q
 (Q
 )Q
 #Q
 #Q
 Q
 
Q
h!&
R&,6B(C86 )-)-.2&*"M
M
 &	M

 'M
 ,M
 $M
 M
 M
 
M
^0& %
 "&!&%
%
 	%

 %
 %
 
%
R &*1
 )-'!1
"1
 &	1

 1
 1
 
1
f7 7rq   rJ  c            	          e Zd ZdZed3d       Zd4dZed5d       Zd6dZd7dZ	d8dZ
	 d9	 	 	 	 	 d:d	Zd;d
Z	 	 	 	 	 	 	 	 d< fdZd9d= fdZ	 d>	 	 	 	 	 d?dZed@ fd       Zd@ fdZedA fd       Z	 	 	 	 	 	 dB fdZ	 	 	 	 	 	 dB fdZdC fdZdDdE fdZdddF fdZ	 d9ddd	 	 	 	 	 	 	 dGdZ	 	 	 	 	 	 dH fdZdIdZedd	 	 	 	 	 dJd       Ze	 	 	 	 	 	 dKd        Zd!d	 	 	 	 	 dLd"Zd!d!d#	 	 	 	 	 	 	 	 	 dM fd$Zd!d%	 	 	 	 	 	 	 dN fd&Z	 	 dOddd'd(	 	 	 	 	 	 	 	 	 	 	 	 	 dP fd)Zddddddd*d'd+	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 dQ fd,Z dRd-Z!	 d9dd.d/d0	 	 	 	 	 	 	 	 	 dS fd1Z"dT fd2Z# xZ$S )UrU  a  Narwhals LazyFrame, backed by a native lazyframe.

    Warning:
        This class is not meant to be instantiated directly - instead use
        [`narwhals.from_native`][] with a native
        object that is a lazy dataframe from one of the supported
        backend (e.g. polars.LazyFrame, dask_expr._collection.DataFrame):
        ```py
        narwhals.from_native(native_lazyframe)
        ```
    c                    | j                   S rk   rM  rm   s    ro   rp   zLazyFrame._compliant  rN  rq   c                   ddl m} ddlm} t	        ||      rd}t        |      t	        ||t        f      rst	        ||      rF|j                  j                  rd}t        |      |j                  j                  rd}t        |      | j                         j                  |d      S t        j                  t        |            )	Nr   r
  r4   zABinary operations between Series and LazyFrame are not supported.a  Order-dependent expressions are not supported for use in LazyFrame.

Hint: To make the expression valid, use `.over` with `order_by` specified.

For example, if you wrote `nw.col('price').cum_sum()` and you have a column
`'date'` which orders your data, then replace:

   nw.col('price').cum_sum()

 with:

   nw.col('price').cum_sum().over(order_by='date')
                            ^^^^^^^^^^^^^^^^^^^^^^

See https://narwhals-dev.github.io/narwhals/concepts/order_dependence/.a1  Length-changing expressions are not supported for use in LazyFrame, unless
followed by an aggregation.

Hints:
- Instead of `lf.select(nw.col('a').head())`, use `lf.select('a').head()
- Instead of `lf.select(nw.col('a').drop_nulls()).select(nw.sum('a'))`,
  use `lf.select(nw.col('a').drop_nulls().sum())
Fr~   )r  r  r  r5   r   r   r   	_metadatan_orderable_opsr/   is_filtrationru   rP  r.   rQ  r   )rn   r   r  r5   r   s        ro   r   zLazyFrame._extract_compliant  s    &*c6"UCC. cD#;'#t$==00b  044==..M  044..0@@QV@WW"44T#Y??rq   c                    t         S rk   )rJ  rm   s    ro   rb  zLazyFrame._dataframe	  rW  rq   c                   || _         |  t        |      r|j                         | _        y dt	        |       }t        |      )NzVExpected Polars LazyFrame or an object that implements `__narwhals_lazyframe__`, got: )rh   r!   __narwhals_lazyframe__rf   r   rZ  r[  s       ro   r\  zLazyFrame.__init__	  sD    !"%$&$=$=$?D!jkoprksjtuC %%rq   c                R    t        d| j                         j                               S )NzNarwhals LazyFrameru  rm   s    ro   rv  zLazyFrame.__repr__%	  rw  rq   c                    d}t        |      )Nz%Slicing is not supported on LazyFrame)r   )rn   r  r   s      ro   r  zLazyFrame.__getitem__(	  s    5nrq   Nc                   | j                   j                  }|| j                   |di |d      S t        j                  |      }t        |      r| j                   ||fi |d      S dt        t               d| d}t        |      )u
  Materialize this LazyFrame into a DataFrame.

        As each underlying lazyframe has different arguments to set when materializing
        the lazyframe into a dataframe, we allow to pass them as kwargs (see examples
        below for how to generalize the specification).

        Arguments:
            backend: specifies which eager backend collect to. This will be the underlying
                backend for the resulting Narwhals DataFrame. If None, then the following
                default conversions will be applied

                - `polars.LazyFrame` -> `polars.DataFrame`
                - `dask.DataFrame` -> `pandas.DataFrame`
                - `duckdb.PyRelation` -> `pyarrow.Table`
                - `pyspark.DataFrame` -> `pyarrow.Table`

                `backend` can be specified in various ways

                - As `Implementation.<BACKEND>` with `BACKEND` being `PANDAS`, `PYARROW`
                    or `POLARS`.
                - As a string: `"pandas"`, `"pyarrow"` or `"polars"`
                - Directly as a module `pandas`, `pyarrow` or `polars`.
            kwargs: backend specific kwargs to pass along. To know more please check the
                backend specific documentation

                - [polars.LazyFrame.collect](https://docs.pola.rs/api/python/dev/reference/lazyframe/api/polars.LazyFrame.collect.html)
                - [dask.dataframe.DataFrame.compute](https://docs.dask.org/en/stable/generated/dask.dataframe.DataFrame.compute.html)

        Examples:
            >>> import duckdb
            >>> import narwhals as nw
            >>> lf_native = duckdb.sql("SELECT * FROM VALUES (1, 2), (3, 4) df(a, b)")
            >>> lf = nw.from_native(lf_native)
            >>> lf
            ┌──────────────────┐
            |Narwhals LazyFrame|
            |------------------|
            |┌───────┬───────┐ |
            |│   a   │   b   │ |
            |│ int32 │ int32 │ |
            |├───────┼───────┤ |
            |│     1 │     2 │ |
            |│     3 │     4 │ |
            |└───────┴───────┘ |
            └──────────────────┘
            >>> lf.collect()
            ┌──────────────────┐
            |Narwhals DataFrame|
            |------------------|
            |  pyarrow.Table   |
            |  a: int32        |
            |  b: int32        |
            |  ----            |
            |  a: [[1,3]]      |
            |  b: [[2,4]]      |
            └──────────────────┘
        r   rw   z-Unsupported `backend` value.
Expected one of z or None, got: r  rk   )	rf   collectrb  r   r`  r   r   r   r  )rn   rf  r   ry  eager_backendr   s         ro   ry  zLazyFrame.collect,	  s    x ''//???7#:6#:&?II&33G< /??7=#CF#C6?RR>xH]?^>__no|n}}~orq   c                    t        | d      S )u~  Convert Narwhals LazyFrame to native one.

        Examples:
            >>> import duckdb
            >>> import narwhals as nw
            >>> lf_native = duckdb.sql("SELECT * FROM VALUES (1, 2), (3, 4) df(a, b)")
            >>> nw.from_native(lf_native).to_native()
            ┌───────┬───────┐
            │   a   │   b   │
            │ int32 │ int32 │
            ├───────┼───────┤
            │     1 │     2 │
            │     3 │     4 │
            └───────┴───────┘
            <BLANKLINE>
        F)narwhals_objectpass_throughr6   rm   s    ro   r7   zLazyFrame.to_nativeq	  s    " EBBrq   c                *    t        |   |g|i |S )u  Pipe function call.

        Arguments:
            function: Function to apply.
            args: Positional arguments to pass to function.
            kwargs: Keyword arguments to pass to function.

        Examples:
            >>> import duckdb
            >>> import narwhals as nw
            >>> lf_native = duckdb.sql("SELECT * FROM VALUES (1, 2), (3, 4) df(a, b)")
            >>> nw.from_native(lf_native).pipe(lambda x: x.select("a")).to_native()
            ┌───────┐
            │   a   │
            │ int32 │
            ├───────┤
            │     1 │
            │     3 │
            └───────┘
            <BLANKLINE>
        r  r  s       ro   r   zLazyFrame.pipe	  s    6 w|H6t6v66rq   c                $    t         |   |      S )uh  Drop rows that contain null values.

        Arguments:
            subset: Column name(s) for which null values are considered. If set to None
                (default), use all columns.

        Notes:
            pandas handles null values differently from Polars and PyArrow.
            See [null_handling](../concepts/null_handling.md/) for reference.

        Examples:
            >>> import duckdb
            >>> import narwhals as nw
            >>> lf_native = duckdb.sql("SELECT * FROM VALUES (1, NULL), (3, 4) df(a, b)")
            >>> nw.from_native(lf_native).drop_nulls()
            ┌──────────────────┐
            |Narwhals LazyFrame|
            |------------------|
            |┌───────┬───────┐ |
            |│   a   │   b   │ |
            |│ int32 │ int32 │ |
            |├───────┼───────┤ |
            |│     3 │     4 │ |
            |└───────┴───────┘ |
            └──────────────────┘
        r   r  r  s     ro   r   zLazyFrame.drop_nulls	  s    6 w!!00rq   c                   t        |t              r|gn|}| j                  | j                  j	                  ||            S )u  Insert column which enumerates rows.

        Arguments:
            name: The name of the column as a string. The default is "index".
            order_by: Column(s) to order by when computing the row index.

        Examples:
            >>> import duckdb
            >>> import narwhals as nw
            >>> lf_native = duckdb.sql("SELECT * FROM VALUES (1, 5), (2, 4) df(a, b)")
            >>> nw.from_native(lf_native).with_row_index(order_by="a").sort("a").collect()
            ┌──────────────────┐
            |Narwhals DataFrame|
            |------------------|
            |  pyarrow.Table   |
            |  index: int64    |
            |  a: int32        |
            |  b: int32        |
            |  ----            |
            |  index: [[0,1]]  |
            |  a: [[1,2]]      |
            |  b: [[5,4]]      |
            └──────────────────┘
            >>> nw.from_native(lf_native).with_row_index(order_by="b").sort("a").collect()
            ┌──────────────────┐
            |Narwhals DataFrame|
            |------------------|
            |  pyarrow.Table   |
            |  index: int64    |
            |  a: int32        |
            |  b: int32        |
            |  ----            |
            |  index: [[1,0]]  |
            |  a: [[1,2]]      |
            |  b: [[5,4]]      |
            └──────────────────┘
        r  r  r  s       ro   r  zLazyFrame.with_row_index	  sC    P #-Xs";XJ	##!!00	0J
 	
rq   c                    | j                   j                  t        j                  urd}t	        |t
               t        |   S )ae  Get an ordered mapping of column names to their data type.

        Examples:
            >>> import duckdb
            >>> import narwhals as nw
            >>> lf_native = duckdb.sql("SELECT * FROM VALUES (1, 4.5), (3, 2.) df(a, b)")
            >>> nw.from_native(lf_native).schema  # doctest:+SKIP
            Schema({'a': Int32, 'b': Decimal})
        zResolving the schema of a LazyFrame is a potentially expensive operation. Use `LazyFrame.collect_schema()` to get the schema without this warning.)rf   rK  r   V1r   r0   r  r   )rn   r   ry   s     ro   r   zLazyFrame.schema	  s?       ));[  #12w~rq   c                     t         |          S )a^  Get an ordered mapping of column names to their data type.

        Examples:
            >>> import duckdb
            >>> import narwhals as nw
            >>> lf_native = duckdb.sql("SELECT * FROM VALUES (1, 4.5), (3, 2.) df(a, b)")
            >>> nw.from_native(lf_native).collect_schema()
            Schema({'a': Int32, 'b': Decimal})
        r  r  s    ro   r   zLazyFrame.collect_schema	  r  rq   c                    t         |   S )a  Get column names.

        Examples:
            >>> import duckdb
            >>> import narwhals as nw
            >>> lf_native = duckdb.sql("SELECT * FROM VALUES (1, 4.5), (3, 2.) df(a, b)")
            >>> nw.from_native(lf_native).columns
            ['a', 'b']
        r  r  s    ro   r   zLazyFrame.columns
  r  rq   c                D    |s|sd}t        |      t        |   |i |S )u  Add columns to this LazyFrame.

        Added columns will replace existing columns with the same name.

        Arguments:
            *exprs: Column(s) to add, specified as positional arguments.
                     Accepts expression input. Strings are parsed as column names, other
                     non-expression inputs are parsed as literals.

            **named_exprs: Additional columns to add, specified as keyword arguments.
                            The columns will be renamed to the keyword used.

        Note:
            Creating a new LazyFrame using this method does not create a new copy of
            existing data.

        Examples:
            >>> import duckdb
            >>> import narwhals as nw
            >>> lf_native = duckdb.sql("SELECT * FROM VALUES (1, 4.5), (3, 2.) df(a, b)")
            >>> nw.from_native(lf_native).with_columns(c=nw.col("a") + 1)
            ┌────────────────────────────────┐
            |       Narwhals LazyFrame       |
            |--------------------------------|
            |┌───────┬──────────────┬───────┐|
            |│   a   │      b       │   c   │|
            |│ int32 │ decimal(2,1) │ int32 │|
            |├───────┼──────────────┼───────┤|
            |│     1 │          4.5 │     2 │|
            |│     3 │          2.0 │     4 │|
            |└───────┴──────────────┴───────┘|
            └────────────────────────────────┘
        z@At least one expression must be passed to LazyFrame.with_columns)r  r  r   rn   r   r   r   ry   s       ro   r   zLazyFrame.with_columns
  s/    H [TCS/!w#U:k::rq   c                D    |s|sd}t        |      t        |   |i |S )u1  Select columns from this LazyFrame.

        Arguments:
            *exprs: Column(s) to select, specified as positional arguments.
                Accepts expression input. Strings are parsed as column names.
            **named_exprs: Additional columns to select, specified as keyword arguments.
                The columns will be renamed to the keyword used.

        Notes:
            If you'd like to select a column whose name isn't a string (for example,
            if you're working with pandas) then you should explicitly use `nw.col` instead
            of just passing the column name. For example, to select a column named
            `0` use `df.select(nw.col(0))`, not `df.select(0)`.

        Examples:
            >>> import duckdb
            >>> import narwhals as nw
            >>> lf_native = duckdb.sql("SELECT * FROM VALUES (1, 4.5), (3, 2.) df(a, b)")
            >>> nw.from_native(lf_native).select("a", a_plus_1=nw.col("a") + 1)
            ┌────────────────────┐
            | Narwhals LazyFrame |
            |--------------------|
            |┌───────┬──────────┐|
            |│   a   │ a_plus_1 │|
            |│ int32 │  int32   │|
            |├───────┼──────────┤|
            |│     1 │        2 │|
            |│     3 │        4 │|
            |└───────┴──────────┘|
            └────────────────────┘
        z:At least one expression must be passed to LazyFrame.select)r  r  r   r  s       ro   r   zLazyFrame.selectA
  s.    D [NCS/!w~u444rq   c                "    t         |   |      S )u  Rename column names.

        Arguments:
            mapping: Key value pairs that map from old name to new name, or a
                      function that takes the old name as input and returns the
                      new name.

        Examples:
            >>> import duckdb
            >>> import narwhals as nw
            >>> lf_native = duckdb.sql("SELECT * FROM VALUES (1, 4.5), (3, 2.) df(a, b)")
            >>> nw.from_native(lf_native).rename({"a": "c"})
            ┌────────────────────────┐
            |   Narwhals LazyFrame   |
            |------------------------|
            |┌───────┬──────────────┐|
            |│   c   │      b       │|
            |│ int32 │ decimal(2,1) │|
            |├───────┼──────────────┤|
            |│     1 │          4.5 │|
            |│     3 │          2.0 │|
            |└───────┴──────────────┘|
            └────────────────────────┘
        r  r  s     ro   r   zLazyFrame.renameh
  s    2 w~g&&rq   c                "    t         |   |      S )u  Get `n` rows.

        Arguments:
            n: Number of rows to return.

        Examples:
            >>> import dask.dataframe as dd
            >>> import narwhals as nw
            >>> lf_native = dd.from_dict({"a": [1, 2, 3], "b": [4, 5, 6]}, npartitions=1)
            >>> nw.from_native(lf_native).head(2).collect()
            ┌──────────────────┐
            |Narwhals DataFrame|
            |------------------|
            |        a  b      |
            |     0  1  4      |
            |     1  2  5      |
            └──────────────────┘
        r  r  s     ro   r   zLazyFrame.head
  r  rq   Tr   c               4    t        |   t        |      d|iS )u  Remove columns from the LazyFrame.

        Arguments:
            *columns: Names of the columns that should be removed from the dataframe.
            strict: Validate that all column names exist in the schema and throw an
                exception if a column name does not exist in the schema.

        Warning:
            `strict` argument is ignored for `polars<1.0.0`.

            Please consider upgrading to a newer version or pass to eager mode.

        Examples:
            >>> import duckdb
            >>> import narwhals as nw
            >>> lf_native = duckdb.sql("SELECT * FROM VALUES (1, 2), (3, 4) df(a, b)")
            >>> nw.from_native(lf_native).drop("a").to_native()
            ┌───────┐
            │   b   │
            │ int32 │
            ├───────┤
            │     2 │
            │     4 │
            └───────┘
            <BLANKLINE>
        r   r  r  s      ro   r   zLazyFrame.drop
  s    6 w|WW-=f==rq   r  )r  r  c                   |dvrdd d| }t        |      |dv r|sd}t        |      t        |t              r|g}| j	                  | j
                  j                  |||            S )u  Drop duplicate rows from this LazyFrame.

        Arguments:
            subset: Column name(s) to consider when identifying duplicate rows.
                     If set to `None`, use all columns.
            keep: {'any', 'none', 'first', 'last}
                Which of the duplicate rows to keep.

                * 'any': Does not give any guarantee of which row is kept.
                * 'none': Don't keep duplicate rows.
                * 'first': Keep the first row. Requires `order_by` to be specified.
                * 'last': Keep the last row. Requires `order_by` to be specified.
            order_by: Column(s) to order by when computing the row index.

        Examples:
            >>> import duckdb
            >>> import narwhals as nw
            >>> lf_native = duckdb.sql("SELECT * FROM VALUES (1, 3), (1, 4) df(a, b)")
            >>> nw.from_native(lf_native).unique("a").sort("a", descending=True)
            ┌──────────────────┐
            |Narwhals LazyFrame|
            |------------------|
            |┌───────┬───────┐ |
            |│   a   │   b   │ |
            |│ int32 │ int32 │ |
            |├───────┼───────┤ |
            |│     1 │     3 │ |
            |└───────┴───────┘ |
            └──────────────────┘
        >   r  r  r  r  r  r  r   >   r  r  znarwhals.LazyFrame makes no assumptions about row order, so only 'first' and 'last' are only supported if `order_by` is passed.)r   r  r  )r  r/   r   r   r{   rf   r  )rn   r   r  r  r   s        ro   r  zLazyFrame.unique
  s    J 77<=WTFKCS/!$$XQ  (,,fc"XF##!!((TH(U
 	
rq   c                    t        |      dk(  r"t        |d   t              r|sd}t        |      t	        |   |i |S )uj  Filter the rows in the LazyFrame based on a predicate expression.

        The original order of the remaining rows is preserved.

        Arguments:
            *predicates: Expression that evaluates to a boolean Series. Can
                also be a (single!) boolean list.
            **constraints: Column filters; use `name = value` to filter columns by the supplied value.
                Each constraint will behave the same as `nw.col(name).eq(value)`, and will be implicitly
                joined with the other filter conditions using &.

        Examples:
            >>> import duckdb
            >>> import narwhals as nw
            >>> df_native = duckdb.sql('''
            ...     SELECT * FROM VALUES
            ...         (1, 6, 'a'),
            ...         (2, 7, 'b'),
            ...         (3, 8, 'c')
            ...     df(foo, bar, ham)
            ... ''')

            Filter on one condition

            >>> nw.from_native(df_native).filter(nw.col("foo") > 1).to_native()
            ┌───────┬───────┬─────────┐
            │  foo  │  bar  │   ham   │
            │ int32 │ int32 │ varchar │
            ├───────┼───────┼─────────┤
            │     2 │     7 │ b       │
            │     3 │     8 │ c       │
            └───────┴───────┴─────────┘
            <BLANKLINE>

            Filter on multiple conditions with implicit `&`

            >>> nw.from_native(df_native).filter(
            ...     nw.col("foo") < 3, nw.col("ham") == "a"
            ... ).to_native()
            ┌───────┬───────┬─────────┐
            │  foo  │  bar  │   ham   │
            │ int32 │ int32 │ varchar │
            ├───────┼───────┼─────────┤
            │     1 │     6 │ a       │
            └───────┴───────┴─────────┘
            <BLANKLINE>

            Filter on multiple conditions with `|`

            >>> nw.from_native(df_native).filter(
            ...     (nw.col("foo") == 1) | (nw.col("ham") == "c")
            ... ).to_native()
            ┌───────┬───────┬─────────┐
            │  foo  │  bar  │   ham   │
            │ int32 │ int32 │ varchar │
            ├───────┼───────┼─────────┤
            │     1 │     6 │ a       │
            │     3 │     8 │ c       │
            └───────┴───────┴─────────┘
            <BLANKLINE>

            Filter using `**kwargs` syntax

            >>> nw.from_native(df_native).filter(foo=2, ham="b").to_native()
            ┌───────┬───────┬─────────┐
            │  foo  │  bar  │   ham   │
            │ int32 │ int32 │ varchar │
            ├───────┼───────┼─────────┤
            │     2 │     7 │ b       │
            └───────┴───────┴─────────┘
            <BLANKLINE>
        r   r   zX`LazyFrame.filter` is not supported with Python boolean masks - use expressions instead.)r   r%   r   r   r  r   )rn   r   r   r   ry   s       ro   r   zLazyFrame.filter
  sD    X 
Oq Z
1t%D[lCC. w~z9[99rq   c                :    | j                   j                  |       y)a  Write LazyFrame to Parquet file.

        This may allow larger-than-RAM datasets to be written to disk.

        Arguments:
            file: String, path object or file-like object to which the dataframe will be
                written.

        Examples:
            >>> import polars as pl
            >>> import narwhals as nw
            >>> df_native = pl.LazyFrame({"foo": [1, 2], "bar": [6.0, 7.0]})
            >>> df = nw.from_native(df_native)
            >>> df.sink_parquet("out.parquet")  # doctest:+SKIP
        N)rf   sink_parquetr  s     ro   r  zLazyFrame.sink_parquet<  s      	**40rq   .r  c                    y rk   rl   r  s      ro   r  zLazyFrame.group_byN        rq   c                    y rk   rl   r  s      ro   r  zLazyFrame.group_byS  r  rq   Fc                  ddl m} t        |      }t        d |D              r || ||      S ddlm} ddlm t        fd|D              }|rt        |      rd}t        |      t        ||      D 	cg c]  \  }}	|	r|n ||       }
}}	 | j                  |
 \  }}t        d	 |D              sdd
lm} d} ||       || ||      S c c}	}w )u  Start a group by operation.

        Arguments:
            *keys: Column(s) to group by. Accepts expression input. Strings are parsed as
                column names.
            drop_null_keys: if True, then groups where any key is null won't be
                included in the result.

        Examples:
            >>> import duckdb
            >>> import narwhals as nw
            >>> df_native = duckdb.sql(
            ...     "SELECT * FROM VALUES (1, 'a'), (2, 'b'), (3, 'a') df(a, b)"
            ... )
            >>> df = nw.from_native(df_native)
            >>> df.group_by("b").agg(nw.col("a").sum()).sort("b").to_native()
            ┌─────────┬────────┐
            │    b    │   a    │
            │ varchar │ int128 │
            ├─────────┼────────┤
            │ a       │      4 │
            │ b       │      2 │
            └─────────┴────────┘
            <BLANKLINE>

            Expressions are also accepted.

            >>> df.group_by(nw.col("b").str.len_chars()).agg(
            ...     nw.col("a").sum()
            ... ).to_native()
            ┌───────┬────────┐
            │   b   │   a    │
            │ int64 │ int128 │
            ├───────┼────────┤
            │     1 │      6 │
            └───────┴────────┘
            <BLANKLINE>
        r   )rM   c              3  <   K   | ]  }t        |t                y wrk   r   r  s     ro   r   z%LazyFrame.group_by.<locals>.<genexpr>  r	  r   r  r   r
  c              3  6   K   | ]  }t        |        y wrk   r  )r   r   r  s     ro   r   z%LazyFrame.group_by.<locals>.<genexpr>  s     CAJq$/Cs   z5drop_null_keys cannot be True when keys contains Exprc              3  @   K   | ]  }|t         j                  u   y wrk   r  r   s     ro   r   z%LazyFrame.group_by.<locals>.<genexpr>  r  r  r  r  )r  rM   r   r   r  r   r  r  r   r  r   r*   r   r  r  )rn   r  r  rM   r  r   key_is_exprr   r   r  r  r  r   r  r  s                 @ro   r  zLazyFrame.group_byX  s    R 	2DM	9y99tY~NN &CCCc+.IC%c** 8B)[7Y
)3GAc!f$
 
 !: 9 95 ABEBB8 [  s##4OO
s   9Cr   c               ,    t        |   |g|||dS )u  Sort the LazyFrame by the given columns.

        Arguments:
            by: Column(s) names to sort by.
            *more_by: Additional columns to sort by, specified as positional arguments.
            descending: Sort in descending order. When sorting by multiple columns, can be
                specified per column by passing a sequence of booleans.
            nulls_last: Place null values last; can specify a single boolean applying to
                all columns or a sequence of booleans for per-column control.

        Warning:
            Unlike Polars, it is not possible to specify a sequence of booleans for
            `nulls_last` in order to control per-column behaviour. Instead a single
            boolean is applied for all `by` columns.

        Examples:
            >>> import duckdb
            >>> import narwhals as nw
            >>> df_native = duckdb.sql(
            ...     "SELECT * FROM VALUES (1, 6.0, 'a'), (2, 5.0, 'c'), (NULL, 4.0, 'b') df(a, b, c)"
            ... )
            >>> df = nw.from_native(df_native)
            >>> df.sort("a")
            ┌──────────────────────────────────┐
            |        Narwhals LazyFrame        |
            |----------------------------------|
            |┌───────┬──────────────┬─────────┐|
            |│   a   │      b       │    c    │|
            |│ int32 │ decimal(2,1) │ varchar │|
            |├───────┼──────────────┼─────────┤|
            |│  NULL │          4.0 │ b       │|
            |│     1 │          6.0 │ a       │|
            |│     2 │          5.0 │ c       │|
            |└───────┴──────────────┴─────────┘|
            └──────────────────────────────────┘
        r   r   r!  s        ro   r   zLazyFrame.sort  s!    V w|BWWZJWWrq   r   c               (    t         |   |||      S )u  Return the `k` largest rows.

        Non-null elements are always preferred over null elements,
        regardless of the value of reverse. The output is not guaranteed
        to be in any particular order, sort the outputs afterwards if you wish the output to be sorted.

        Arguments:
            k: Number of rows to return.
            by: Column(s) used to determine the top rows. Accepts expression input. Strings are parsed as column names.
            reverse: Consider the k smallest elements of the by column(s) (instead of the k largest).
                This can be specified per column by passing a sequence of booleans.

        Returns:
            The LazyFrame with the `k` largest rows.

        Examples:
            >>> import duckdb
            >>> import narwhals as nw
            >>> df_native = duckdb.sql(
            ...     "SELECT * FROM VALUES ('a', 2), ('b', 1), ('a', 1), ('b', 3), (NULL, 2), ('c', 1) df(a, b)"
            ... )
            >>> df = nw.from_native(df_native)
            >>> df.top_k(4, by=["b", "a"])
            ┌───────────────────┐
            |Narwhals LazyFrame |
            |-------------------|
            |┌─────────┬───────┐|
            |│    a    │   b   │|
            |│ varchar │ int32 │|
            |├─────────┼───────┤|
            |│ b       │     3 │|
            |│ a       │     2 │|
            |│ NULL    │     2 │|
            |│ c       │     1 │|
            |└─────────┴───────┘|
            └───────────────────┘
        r   r#  r$  s       ro   r   zLazyFrame.top_k  s    P w}Q2w}77rq   r%  r&  c               .    t         |   ||||||      S )u  Add a join operation to the Logical Plan.

        Arguments:
            other: Lazy DataFrame to join with.
            on: Name(s) of the join columns in both DataFrames. If set, `left_on` and
                `right_on` should be None.
            how: Join strategy.

                  * *inner*: Returns rows that have matching values in both tables.
                  * *left*: Returns all rows from the left table, and the matched rows from the right table.
                  * *full*: Returns all rows in both dataframes, with the suffix appended to the right join keys.
                  * *cross*: Returns the Cartesian product of rows from both tables.
                  * *semi*: Filter rows that have a match in the right table.
                  * *anti*: Filter rows that do not have a match in the right table.
            left_on: Join column of the left DataFrame.
            right_on: Join column of the right DataFrame.
            suffix: Suffix to append to columns with a duplicate name.

        Examples:
            >>> import duckdb
            >>> import narwhals as nw
            >>> df_native1 = duckdb.sql(
            ...     "SELECT * FROM VALUES (1, 'a'), (2, 'b') df(a, b)"
            ... )
            >>> df_native2 = duckdb.sql(
            ...     "SELECT * FROM VALUES (1, 'x'), (3, 'y') df(a, c)"
            ... )
            >>> df1 = nw.from_native(df_native1)
            >>> df2 = nw.from_native(df_native2)
            >>> df1.join(df2, on="a")
            ┌─────────────────────────────┐
            |     Narwhals LazyFrame      |
            |-----------------------------|
            |┌───────┬─────────┬─────────┐|
            |│   a   │    b    │    c    │|
            |│ int32 │ varchar │ varchar │|
            |├───────┼─────────┼─────────┤|
            |│     1 │ a       │ x       │|
            |└───────┴─────────┴─────────┘|
            └─────────────────────────────┘
        r(  r)  r*  s          ro   r	  zLazyFrame.join  s)    f w|sGh2f  
 	
rq   r  r+  c               4    t         
|   |||||||||		      S )u  Perform an asof join.

        This is similar to a left-join except that we match on nearest key rather than equal keys.

        For Polars, both DataFrames must be sorted by the `on` key (within each `by` group
        if specified).

        Arguments:
            other: DataFrame to join with.
            left_on: Name(s) of the left join column(s).
            right_on: Name(s) of the right join column(s).
            on: Join column of both DataFrames. If set, left_on and right_on should be None.
            by_left: join on these columns before doing asof join
            by_right: join on these columns before doing asof join
            by: join on these columns before doing asof join
            strategy: Join strategy. The default is "backward".

                  * *backward*: selects the last row in the right DataFrame whose "on" key is less than or equal to the left's key.
                  * *forward*: selects the first row in the right DataFrame whose "on" key is greater than or equal to the left's key.
                  * *nearest*: search selects the last row in the right DataFrame whose value is nearest to the left's key.

            suffix: Suffix to append to columns with a duplicate name.

        Examples:
            >>> from datetime import datetime
            >>> import polars as pl
            >>> import narwhals as nw
            >>> data_gdp = {
            ...     "datetime": [
            ...         datetime(2016, 1, 1),
            ...         datetime(2017, 1, 1),
            ...         datetime(2018, 1, 1),
            ...         datetime(2019, 1, 1),
            ...         datetime(2020, 1, 1),
            ...     ],
            ...     "gdp": [4164, 4411, 4566, 4696, 4827],
            ... }
            >>> data_population = {
            ...     "datetime": [
            ...         datetime(2016, 3, 1),
            ...         datetime(2018, 8, 1),
            ...         datetime(2019, 1, 1),
            ...     ],
            ...     "population": [82.19, 82.66, 83.12],
            ... }
            >>> gdp_native = pl.DataFrame(data_gdp)
            >>> population_native = pl.DataFrame(data_population)
            >>> gdp = nw.from_native(gdp_native)
            >>> population = nw.from_native(population_native)
            >>> population.join_asof(gdp, on="datetime", strategy="backward").to_native()
            shape: (3, 3)
            ┌─────────────────────┬────────────┬──────┐
            │ datetime            ┆ population ┆ gdp  │
            │ ---                 ┆ ---        ┆ ---  │
            │ datetime[μs]        ┆ f64        ┆ i64  │
            ╞═════════════════════╪════════════╪══════╡
            │ 2016-03-01 00:00:00 ┆ 82.19      ┆ 4164 │
            │ 2018-08-01 00:00:00 ┆ 82.66      ┆ 4566 │
            │ 2019-01-01 00:00:00 ┆ 83.12      ┆ 4696 │
            └─────────────────────┴────────────┴──────┘
        r+  r-  r.  s             ro   r  zLazyFrame.join_asof.  s8    T w  ! 

 
	
rq   c                    | S )zRestrict available API methods to lazy-only ones.

        This is a no-op, and exists only for compatibility with `DataFrame.lazy`.
        rl   rm   s    ro   r  zLazyFrame.lazy  s	    
 rq   rJ  r  rK  c               *    t         |   ||||      S )u  Unpivot a DataFrame from wide to long format.

        Optionally leaves identifiers set.

        This function is useful to massage a DataFrame into a format where one or more
        columns are identifier variables (index) while all other columns, considered
        measured variables (on), are "unpivoted" to the row axis leaving just
        two non-identifier columns, 'variable' and 'value'.

        Arguments:
            on: Column(s) to use as values variables; if `on` is empty all columns that
                are not in `index` will be used.
            index: Column(s) to use as identifier variables.
            variable_name: Name to give to the `variable` column. Defaults to "variable".
            value_name: Name to give to the `value` column. Defaults to "value".

        Notes:
            If you're coming from pandas, this is similar to `pandas.DataFrame.melt`,
            but with `index` replacing `id_vars` and `on` replacing `value_vars`.
            In other frameworks, you might know this operation as `pivot_longer`.

        Examples:
            >>> import duckdb
            >>> import narwhals as nw
            >>> df_native = duckdb.sql(
            ...     "SELECT * FROM VALUES ('x', 1, 2), ('y', 3, 4), ('z', 5, 6) df(a, b, c)"
            ... )
            >>> df = nw.from_native(df_native)
            >>> df.unpivot(on=["b", "c"], index="a").sort("a", "variable").to_native()
            ┌─────────┬──────────┬───────┐
            │    a    │ variable │ value │
            │ varchar │ varchar  │ int32 │
            ├─────────┼──────────┼───────┤
            │ x       │ b        │     1 │
            │ x       │ c        │     2 │
            │ y       │ b        │     3 │
            │ y       │ c        │     4 │
            │ z       │ b        │     5 │
            │ z       │ c        │     6 │
            └─────────┴──────────┴───────┘
            <BLANKLINE>
        r  rM  rN  s        ro   r!  zLazyFrame.unpivot  s%    d wm
  
 	
rq   c                $    t        |   |g| S )u  Explode the dataframe to long format by exploding the given columns.

        Notes:
            It is possible to explode multiple columns only if these columns have
            matching element counts.

        Arguments:
            columns: Column names. The underlying columns being exploded must be of the `List` data type.
            *more_columns: Additional names of columns to explode, specified as positional arguments.

        Examples:
            >>> import duckdb
            >>> import narwhals as nw
            >>> df_native = duckdb.sql(
            ...     "SELECT * FROM VALUES ('x', [1, 2]), ('y', [3, 4]), ('z', [5, 6]) df(a, b)"
            ... )
            >>> df = nw.from_native(df_native)
            >>> df.explode("b").to_native()
            ┌─────────┬───────┐
            │    a    │   b   │
            │ varchar │ int32 │
            ├─────────┼───────┤
            │ x       │     1 │
            │ x       │     2 │
            │ y       │     3 │
            │ y       │     4 │
            │ z       │     5 │
            │ z       │     6 │
            └─────────┴───────┘
            <BLANKLINE>
        rP  rQ  s      ro   r)  zLazyFrame.explode  s    @ ww666rq   )r,  z)CompliantLazyFrame[Any, LazyFrameT, Self]r.  )r,  ztype[DataFrame[Any]]rR  rW  )r  zstr | slicer,  r   rk   )rf  z+IntoBackend[Polars | Pandas | Arrow] | Noner   r   r,  rU  )r,  ra   r0  r1  r]  )r   r   r  rC  r,  rA   r/  r3  r4  r5  r_  r6  ra  )r   r2  r  r[   r  r^  r,  rA   r8  rX  )r  r-  r  r\  r,  LazyGroupBy[Self])r  r:  r  r[  r,  r  )r  r-  r  r   r,  r  r9  r<  rc  rd  re  rf  r@  rB  )%rD  rE  rF  rh  rH  rp   r   rb  r\  rv  r  ry  r7   r   r   r  r   r   r   r   r   r   r   r   r  r   r  r   r  r   r   r	  r  r  r!  r)  rk  rl  s   @ro   rU  rU    s   
 % %!@F  &P
 FJCBCUXC	CJC(747 7 	7
 
7:1< "+
+
0C+
	+
Z  $
( 
 
';3';DL';	';R%53%5DL%5	%5N'6* BF >> *.2
 $)/32
&2
 !	2

 -2
 
2
hQ:EQ:VYQ:	Q:f1$ UX 2 DR 	     ( :G 	   
 LQFP2FPDHFP	FPX -2 +X+X +X *	+X
 +X 
+X\ TY(8(80(8;P(8	(8Z &*#	5
 +/+/5
5
 #5
 	5
 (5
 )5
 5
 
5
v ##*.+/%)%/T
T
 	T

 T
 T
 (T
 )T
 #T
 #T
 T
 
T
l &*4
 )-'!4
"4
 &	4

 4
 4
 
4
l 7  7rq   rU  )
__future__r   abcr   	itertoolsr   typingr   r   r   r	   r
   r   r   r   r   r   narwhals._exceptionsr   narwhals._expression_parsingr   r   r   r   narwhals._typingr   r   r   r   narwhals._utilsr   r   r   r   r   r   r   r    r!   r"   r#   r$   r%   r&   r'   r(   r)   r*   narwhals.dependenciesr+   r,   r  r-   r.   r/   r0   r   r1   r2   narwhals.schemar3   r  r5   narwhals.translater7   collections.abcr8   r9   r:   r;   ior<   pathlibr=   typesr>   pandaspdpolarsplpyarrowpatyping_extensionsr?   r@   rA   rB   narwhals._compliantrC   rD   narwhals._compliant.typingrE   rF   narwhals._translaterG   rH   rI   rJ   rK   r  rL   rM   narwhals.typingrN   rO   rP   rQ   rR   rS   rT   rU   _MultiColSelectorrV   _MultiIndexSelectorrW   rX   rY   rZ   r[   r\   r]   r^   rG  r_   ra   rb   rc   re   rJ  rU  rl   rq   ro   <module>r     sN   "     /  T S    ( F  F " " (EE IIJN2OO6    $ 
4BJ	
);
/\9
\9
CL> ) > B I BTW  TWn
b7	*% b7J9}7	*% }7rq   