
    -Ph6                       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 d dlmZ d dlZd dlmZmZmZ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#m$Z$m%Z%m&Z& d d	l'm(Z)m*Z+ d d
l,m-Z- d dl.m/Z/ d dl0m1Z2 d dl3m4Z4m5Z5m6Z6m7Z7 d dl8m9Z: d dl;m<Z= d dl>m?Z? d dl@mAZAmBZBmCZCmDZDmEZEmFZFmGZGmHZHmIZImJZJmKZKmLZLmMZMmNZNmOZOmPZPmQZQmRZRmSZSmTZTmUZUmVZVmWZWmXZXmYZYmZZZm[Z[m\Z\ d dl]m^Z^m_Z_m`Z` d dlambZbmcZc erd dldmeZe d dlfmgZgmhZh d dlimjZj d dl'mkZkmlZl d dlmmnZn d dlamoZompZpmqZqmrZrmsZsmtZtmuZumvZvmwZwmxZx  edd          Zy edd          Zz edd           Z{ ed!e"          Z| egd#          Z} ed$          Z~ ed%d&e'          Z G d( d)e)eb                   Z( G d* d+e+ec                   Z* G d, d-e=e                   Z< G d. d/e2          Z1 G d0 d1e:          Z9edd6            Zedd9            Zedd<            Zedd>            ZddAZeddE            ZeddF            ZeddG            ZeddI            ZedJdJdKddU            ZedJdJdVddW            ZedJdJdJdXdd\            ZedJdJdJdXdd]            ZedJdJdJd^d d_            ZedJdJdJd^dd`            ZedJdJdJdaddd            ZedJdJdJdeddf            ZedJdJdJdJdgddj            ZedJdJdJdJdgddk            ZedJdJdJdJdlddm            ZedJdJdJdJdnddo            ZedJdJdJdJdpdds            ZedJdJdJdJdtd	du            ZedJdJdJdJdJdvd
dy            ZedJdJdJdJdJdvddz            ZedJdJdKdd}            ZedJdJdVdd~            ZedJdJdJdXdd            ZedJdJdJdXdd            ZedJdJdJd^dd            ZedJdJdJd^dd            ZedJdJdJdadd            ZedJdJdJdedd            ZedJdJdJdJdgdd            ZedJdJdJdJdgdd            ZedJdJdJdJddd            ZedJdJdJdJddd            ZedJdJdJdJddd            ZedJdJdJdJddd            ZedJdJdJdJdJddd            Zedddd            ZdddddddddZedJddd            ZedJddd            ZedJddd            Zed d            ZedJdd!d            ZedJdd"d            ZedJdd#d            Zed$d            Zdddd%dZ	 d&dddddddd'dZd(dZd)dZd)dZd*dZd(dZd&d+dZd,dZd,dZd,dZd,dZd,dZd-dńZd-dƄZd-dǄZd-dȄZd-dɄZd-dʄZddd̜d.dфZ G d҄ dej                  Z G dԄ dej        e1          Zd/dׄZ edئ          	 d&dddٜd0d            Z edئ          dddٜd1d            Z e            	 d&dddٜd2d            Z edئ          	 d&dddٜd3d            Z edئ          dddٜd4d            Z edئ          dddٜd5d            Z edئ          dddٜd4d            Z edئ          dddٜd5d            Zg dZdS (6      )annotationswraps)	TYPE_CHECKINGAnyCallableIterableLiteralMappingSequencecastoverload)warnN)dependencies
exceptions	functions	selectors)TypeVar)ImplementationVersiondeprecate_native_namespacefind_stacklevelgenerate_temporary_column_nameinherit_docis_ordered_categoricalmaybe_align_indexmaybe_convert_dtypesmaybe_get_indexmaybe_reset_indexmaybe_set_indexvalidate_strict_and_pass_though)	DataFrame	LazyFrame)
get_polars)InvalidIntoExprErrorExpr)_new_series_implconcat	get_levelshow_versions)SchemaSeries)dtypes)ArrayBinaryBooleanCategoricalDateDatetimeDecimalDurationEnumFieldFloat32Float64Int8Int16Int32Int64Int128ListObjectStringStructTimeUInt8UInt16UInt32UInt64UInt128Unknown)_from_native_implget_native_namespaceto_py_scalar)IntoDataFrameT
IntoFrameT)
ModuleType)	ParamSpecSelf)IntoArrowTable)MultiColSelectorMultiIndexSelector)DType)
	IntoDTypeIntoExpr	IntoFrameIntoLazyFrameT
IntoSeriesNonNestedLiteralSingleColSelectorSingleIndexSelector_1DArray_2DArray
DataFrameTDataFrame[Any])bound
LazyFrameTLazyFrame[Any]SeriesTSeries[Any]T)defaultPRIntoSeriesTr\   )rd   rj   c                  V    e Zd Z ee          d. fd            Zed/d	            Zed0d            Ze	d1d            Z
e	d2d            Z
e	d3d            Z
d4 fdZ
	 d5d6 fdZe	ddd7d"            Ze	d8d%            Ze	d9d(            Zd)dd9 fd*Zd: fd+Zd: fd,Zd;d-Z xZS )<r"   dfr   level&Literal['full', 'lazy', 'interchange']returnNonec               x    |j         t          j        u sJ t                                          ||           d S Nrp   _versionr   V1super__init__selfro   rp   	__class__s      [/var/www/html/test/jupyter/venv/lib/python3.11/site-packages/narwhals/stable/v1/__init__.pyr{   zDataFrame.__init__l   ;    {gj((((5)))))    type[Series[Any]]c                ,    t          dt                    S )Nr   )r   r.   r}   s    r   _serieszDataFrame._seriest   s    '000r   type[LazyFrame[Any]]c                ,    t          dt                    S )Nr   )r   r#   r   s    r   
_lazyframezDataFrame._lazyframex   s    *I666r   item-tuple[SingleIndexSelector, SingleColSelector]c                    d S N r}   r   s     r   __getitem__zDataFrame.__getitem__|   s    WZWZr   2str | tuple[MultiIndexSelector, SingleColSelector]rh   c                    d S r   r   r   s     r   r   zDataFrame.__getitem__   s	     cr   SingleIndexSelector | MultiIndexSelector | MultiColSelector | tuple[SingleIndexSelector, MultiColSelector] | tuple[MultiIndexSelector, MultiColSelector]rS   c                    d S r   r   r   s     r   r   zDataFrame.__getitem__   s	     sr     SingleIndexSelector | SingleColSelector | MultiColSelector | MultiIndexSelector | tuple[SingleIndexSelector, SingleColSelector] | tuple[SingleIndexSelector, MultiColSelector] | tuple[MultiIndexSelector, SingleColSelector] | tuple[MultiIndexSelector, MultiColSelector]Series[Any] | Self | Anyc                F    t                                          |          S r   )rz   r   )r}   r   r~   s     r   r   zDataFrame.__getitem__   s     ww""4(((r   Nbackend(ModuleType | Implementation | str | Nonerf   c                b    t          t                                          |                    S )Nr   )
_stableifyrz   lazy)r}   r   r~   s     r   r   zDataFrame.lazy   s%     %'',,w,77888r   .	as_seriesr   Literal[True]dict[str, Series[Any]]c                   d S r   r   r}   r   s     r   to_dictzDataFrame.to_dict   s    TWTWr   Literal[False]dict[str, list[Any]]c                   d S r   r   r   s     r   r   zDataFrame.to_dict   s    MPSr   bool-dict[str, Series[Any]] | dict[str, list[Any]]c                   d S r   r   r   s     r   r   zDataFrame.to_dict   s	     9<r   Tc               H    t                                          |          S )Nr   )rz   r   )r}   r   r~   s     r   r   zDataFrame.to_dict   s    
 ww333r   c                ^    t          t                                                                S r   )r   rz   is_duplicatedr}   r~   s    r   r   zDataFrame.is_duplicated   s!    %''//11222r   c                ^    t          t                                                                S r   )r   rz   	is_uniquer   s    r   r   zDataFrame.is_unique   s!    %''++--...r   c                h    |                      t                                                                S )zbPrivate, just used to test the stable API.

        Returns:
            A new DataFrame.
        selectall_l1_normr   s    r   r   zDataFrame._l1_norm   $     {{355>>++,,,r   ro   r   rp   rq   rr   rs   )rr   r   )rr   r   )r   r   rr   r   )r   r   rr   rh   )r   r   rr   rS   )r   r   rr   r   r   )r   r   rr   rf   )r   r   rr   r   )r   r   rr   r   )r   r   rr   r   )rr   rh   rr   rS   )__name__
__module____qualname__r   NwDataFramer{   propertyr   r   r   r   r   r   r   r   r   __classcell__r~   s   @r   r"   r"   k   s       [* * * * * * 1 1 1 X1 7 7 7 X7 ZZZ XZ   X 	 	 	 X	) ) ) ) ) )  CG9 9 9 9 9 9 9
 47WWWWW XWPPP XP< < < X< $(4 4 4 4 4 4 4 43 3 3 3 3 3/ / / / / /- - - - - - - -r   r"   c                       e Zd Z ee          d fd            Zedd	            ZddZ	 dd fdZ	d dZ
d!d" fdZd#d$dZ xZS )%r#   ro   r   rp   rq   rr   rs   c               x    |j         t          j        u sJ t                                          ||           d S ru   rw   r|   s      r   r{   zLazyFrame.__init__   r   r   type[DataFrame[Any]]c                    t           S r   r"   r   s    r   
_dataframezLazyFrame._dataframe       r   argc                ^   ddl m} ddlm} ddlm} t          ||          r|j        S t          ||          rd}t          |          t          ||          r'|	                    | 
                                          S t          |t                    r)| 
                                }|                    |          S t                      @dt          t          |                    v r"dt          |           d}t          |          t          j        t          |                    )	Nr   	BaseFramer&   r-   z.Mixing Series with LazyFrame is not supported.polarszExpected Narwhals object, got: z[.

Perhaps you:
- Forgot a `nw.from_native` somewhere?
- Used `pl.col` instead of `nw.col`?)narwhals.dataframer   narwhals.exprr'   narwhals.seriesr.   
isinstance_compliant_frame	TypeError_to_compliant_expr__narwhals_namespace__strcolr$   typer%   from_invalid_type)r}   r   r   r'   r.   msgplxs          r   _extract_compliantzLazyFrame._extract_compliant   sD    	100000&&&&&&******c9%% 	(''c6"" 	!BCC.. c4   	I))$*E*E*G*GHHHc3 	 --//C773<<<<#CS		NN(B(B7$s)) 7 7 7  C.. "4T#YY???r   Nr   r   kwargsrc   c                T    t           t                      j        dd|i|          S )Nr   r   )r   rz   collect)r}   r   r   r~   s      r   r   zLazyFrame.collect   s.     /%''/DD'DVDDEEEr   rS   c                h    |                      t                                                                S )zbPrivate, just used to test the stable API.

        Returns:
            A new lazyframe.
        r   r   s    r   r   zLazyFrame._l1_norm   r   r      nintc                F    t                                          |          S )zGet the last `n` rows.

        Arguments:
            n: Number of rows to return.

        Returns:
            A subset of the LazyFrame of shape (n, n_columns).
        )rz   tail)r}   r   r~   s     r   r   zLazyFrame.tail   s     ww||Ar   r   offsetc                `    |                      | j                            ||                    S )zTake every nth row in the DataFrame and return as a new DataFrame.

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

        Returns:
            The LazyFrame containing only the selected rows.
        r   r   )_with_compliantr   gather_everyr}   r   r   s      r   r   zLazyFrame.gather_every   s5     ##!..6.BB
 
 	
r   r   rr   r   )r   r   rr   r   r   )r   r   r   r   rr   rc   r   )r   r   r   rr   rS   r   r   r   r   r   rr   rS   )r   r   r   r   NwLazyFramer{   r   r   r   r   r   r   r   r   r   s   @r   r#   r#      s       [* * * * * *    X@ @ @ @: CGF F F F F F F
- - - -	 	 	 	 	 	 	
 
 
 
 
 
 
 
 
r   r#   c                       e Zd Z ee          d fd            Zedd	            Zd  fdZdddddd! fdZ		 d"dddd# fdZ
 xZS )$r.   seriesr   rp   rq   rr   rs   c               x    |j         t          j        u sJ t                                          ||           d S ru   rw   )r}   r   rp   r~   s      r   r{   zSeries.__init__  s=     '*,,,,u-----r   r   c                    t           S r   r   r   s    r   r   zSeries._dataframe  r   r   rc   c                ^    t          t                                                                S r   )r   rz   to_framer   s    r   r   zSeries.to_frame  s!    %''**,,---r   FNsortparallelname	normalizer   r   r   r   
str | Noner   c               h    t          t                                          ||||                    S )Nr   )r   rz   value_counts)r}   r   r   r   r   r~   s        r   r   zSeries.value_counts   s<     GG  H49 !  
 
 	
r   T)	bin_countinclude_breakpointbinslist[float | int] | Noner   
int | Noner   c                   ddl m} ddlm} d}t	          || |                       t          t                                          |||                    S )Nr   )r   )NarwhalsUnstableWarningzZ`Series.hist` is being called from the stable API although considered an unstable feature.messagecategory
stacklevel)r   r   r   )narwhals._utilsr   narwhals.exceptionsr  r   r   rz   hist)r}   r   r   r   r   r  r   r~   s          r   r	  zSeries.hist.  s     	433333??????# 	 	S#:GXGXYYYYGGLLYCU   
 
 	
r   )r   r   rp   rq   rr   rs   r   )rr   rc   )
r   r   r   r   r   r   r   r   rr   rc   r   )r   r   r   r   r   r   rr   rc   )r   r   r   r   NwSeriesr{   r   r   r   r   r	  r   r   s   @r   r.   r.     s        [. . . . . .    X. . . . . . 
 
 
 
 
 
 
 
  *.
 !%#'
 
 
 
 
 
 
 
 
 
 
 
r   r.   c                  z     e Zd Zd fdZd d!dZd d!dZd"d#dZddd$dZdddd%dZddZ		 d&ddddd'dZ
 xZS )(r'   rr   rS   c                D    t                                                      S r   )rz   _taxicab_normr   s    r   r   zExpr._l1_normE  s    ww$$&&&r   
   r   r   c                8                            fd          S )zGet the first `n` rows.

        Arguments:
            n: Number of rows to return.

        Returns:
            A new expression.
        c                T                         |                                         S r   )r   headr   r   r}   s    r   <lambda>zExpr.head.<locals>.<lambda>R  #    //4499!<< r   _with_orderable_filtrationr}   r   s   ``r   r  z	Expr.headH  -     ..<<<<<
 
 	
r   c                8                            fd          S )zGet the last `n` rows.

        Arguments:
            n: Number of rows to return.

        Returns:
            A new expression.
        c                T                         |                                         S r   )r   r   r  s    r   r  zExpr.tail.<locals>.<lambda>_  r  r   r  r  s   ``r   r   z	Expr.tailU  r  r   r   r   c                <                            fd          S )zTake every nth value in the Series and return as new Series.

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

        Returns:
            A new expression.
        c                X                         |                                         S )Nr   )r   r   )r   r   r   r}   s    r   r  z#Expr.gather_every.<locals>.<lambda>m  s(    //44AAAfAUU r   r  r   s   ```r   r   zExpr.gather_everyb  s1     ..UUUUUU
 
 	
r   N)maintain_orderr  bool | Nonec                    |%d}t          |t          t                                                       fd          S )aT  Return unique values of this expression.

        Arguments:
            maintain_order: Keep the same order as the original expression.
                This is deprecated and will be removed in a future version,
                but will still be kept around in `narwhals.stable.v1`.

        Returns:
            A new expression.
        Nzx`maintain_order` has no effect and is only kept around for backwards-compatibility. You can safely remove this argument.r  c                R                         |                                           S r   )r   uniquer   r}   s    r   r  zExpr.unique.<locals>.<lambda>  s!    1H1H1M1M1T1T1V1V r   )r   UserWarningr   _with_filtration)r}   r  r   s   `  r   r!  zExpr.uniquep  sP     %7  {?P?PQQQQ$$%V%V%V%VWWWr   F
descending
nulls_lastr&  r   r'  c               <                            fd          S )zSort this column. Place null values first.

        Arguments:
            descending: Sort in descending order.
            nulls_last: Place null values last instead of first.

        Returns:
            A new expression.
        c                X                         |                                         S )Nr%  )r   r   )r   r&  r'  r}   s    r   r  zExpr.sort.<locals>.<lambda>  s/    //4499%* :   r   )_with_unorderable_window)r}   r&  r'  s   ```r   r   z	Expr.sort  s=     ,,     
 
 	
r   c                4                            fd          S )zhFind elements where boolean expression is True.

        Returns:
            A new expression.
        c                R                         |                                           S r   )r   arg_truer"  s    r   r  zExpr.arg_true.<locals>.<lambda>  s!    //44==?? r   r  r   s   `r   r-  zExpr.arg_true  s)     ..????
 
 	
r   fractionwith_replacementseedr   r/  float | Noner0  r1  c               D                            fd          S )a  Sample randomly from this expression.

        Arguments:
            n: Number of items to return. Cannot be used with fraction.
            fraction: Fraction of items to return. Cannot be used with n.
            with_replacement: Allow values to be sampled more than once.
            seed: Seed for the random number generator. If set to None (default), a random
                seed is generated for each sample operation.

        Returns:
            A new expression.
        c                \                         |                                         S )Nr.  )r   sample)r   r/  r   r1  r}   r0  s    r   r  zExpr.sample.<locals>.<lambda>  s4    //44;;H7Gd <   r   )r$  )r}   r   r/  r0  r1  s   `````r   r5  zExpr.sample  sI    ( $$       
 
 	
r   r   )r  r   r   r   )r  r  rr   rS   )r&  r   r'  r   rr   rS   r   )
r   r   r/  r2  r0  r   r1  r   rr   rS   )r   r   r   r   r  r   r   r!  r   r-  r5  r   r   s   @r   r'   r'   D  s       ' ' ' ' ' '
 
 
 
 

 
 
 
 

 
 
 
 
 7; X X X X X X& */5 
 
 
 
 
 
 
 
 
 
 
 "&!&
 
 
 
 
 
 
 
 
 
r   r'   c                  T     e Zd Zej        Z ee          	 dd fd            Z xZ	S )	r,   Nschema8Mapping[str, DType] | Iterable[tuple[str, DType]] | Nonerr   rs   c                J    t                                          |           d S r   )rz   r{   )r}   r7  r~   s     r   r{   zSchema.__init__  s#     	     r   r   )r7  r8  rr   rs   )
r   r   r   r   ry   rx   r   NwSchemar{   r   r   s   @r   r,   r,     sa        zH[QU! ! ! ! ! ! ! ! ! ! !r   r,   objNwDataFrame[IntoFrameT]rr   DataFrame[IntoFrameT]c                    d S r   r   r;  s    r   r   r         GJsr   NwLazyFrame[IntoFrameT]LazyFrame[IntoFrameT]c                    d S r   r   r?  s    r   r   r     r@  r   NwSeries[IntoSeriesT]Series[IntoSeriesT]c                    d S r   r   r?  s    r   r   r         CF3r   NwExprc                    d S r   r   r?  s    r   r   r     s    %(Sr   RNwDataFrame[IntoFrameT] | NwLazyFrame[IntoFrameT] | NwSeries[IntoSeriesT] | NwExprJDataFrame[IntoFrameT] | LazyFrame[IntoFrameT] | Series[IntoSeriesT] | Exprc                p   t          | t                    r8t          | j                            t
          j                  | j                  S t          | t                    r8t          | j                            t
          j                  | j                  S t          | t                    r8t          | j                            t
          j                  | j                  S t          | t                    rt          | j        | j                  S dt#          |            }t%          |          )Nrv   z5Expected DataFrame, LazyFrame, Series, or Expr, got: )r   r   r"   r   _with_versionr   ry   _levelr   r#   r
  r.   _compliant_seriesrH  r'   r   	_metadatar   AssertionError)r;  r   s     r   r   r     s     #{## [-;;GJGGszZZZZ#{## [-;;GJGGszZZZZ#x   Yc+99'*EESZXXXX#v ;C*CM:::
M$s))
M
MC


r   native_objectkwdsr   c                    d S r   r   rR  rS  s     r   from_nativerV    s    ADr   c                    d S r   r   rU  s     r   rV  rV    r@  r   c                    d S r   r   rU  s     r   rV  rV    r@  r   DataFrameT | LazyFrameTc                    d S r   r   rU  s     r   rV  rV    s	     "cr   .)
eager_onlyseries_onlyIntoDataFrameT | IntoSeriesTstrictr   r[  eager_or_interchange_onlyr   r\  allow_series/DataFrame[IntoDataFrameT] | Series[IntoSeriesT]c                   d S r   r   rR  r^  r[  r_  r\  r`  s         r   rV  rV    	     7:cr   )r_  r\  c                   d S r   r   rc  s         r   rV  rV    rd  r   )r[  r\  r`  rO   rs   DataFrame[IntoDataFrameT]c                   d S r   r   rc  s         r   rV  rV    	     !$r   c                   d S r   r   rc  s         r   rV  rV    	     	r   )r_  r\  r`  c                   d S r   r   rc  s         r   rV  rV     rh  r   c                   d S r   r   rc  s         r   rV  rV  ,  rj  r   )r[  r_  r\  IntoFrameT | IntoSeriesTCDataFrame[IntoFrameT] | LazyFrame[IntoFrameT] | Series[IntoSeriesT]c                   d S r   r   rc  s         r   rV  rV  8       KN#r   )r[  r_  r`  c                   d S r   r   rc  s         r   rV  rV  D  	     #r   )r[  r_  r\  r`  rP   -DataFrame[IntoFrameT] | LazyFrame[IntoFrameT]c                   d S r   r   rc  s         r   rV  rV  P  	     58Cr   c                   d S r   r   rc  s         r   rV  rV  \  rj  r   )r^  r[  r\  r`  c                   d S r   r   rc  s         r   rV  rV  h  rh  r   )r^  r_  r\  r`  c                   d S r   r   rc  s         r   rV  rV  t  rh  r   )r^  r[  r_  r\  IntoFrame | IntoSeries-DataFrame[Any] | LazyFrame[Any] | Series[Any]c                   d S r   r   rc  s         r   rV  rV    ru  r   )r^  r[  r_  r`  c                   d S r   r   rc  s         r   rV  rV    rr  r   )r^  r[  r_  r\  r`  r[   LazyFrame[IntoLazyFrameT]c                   d S r   r   rc  s         r   rV  rV    rh  r   c                   d S r   r   rc  s         r   rV  rV    ru  r   IntoDataFrameT | IntoSeriespass_throughc                   d S r   r   rR  r  r[  r_  r\  r`  s         r   rV  rV    rh  r   c                   d S r   r   r  s         r   rV  rV    rd  r   c                   d S r   r   r  s         r   rV  rV    rh  r   c                   d S r   r   r  s         r   rV  rV    rj  r   c                   d S r   r   r  s         r   rV  rV    rh  r   c                   d S r   r   r  s         r   rV  rV    rj  r   c                   d S r   r   r  s         r   rV  rV    rp  r   c                   d S r   r   r  s         r   rV  rV    rr  r   c                   d S r   r   r  s         r   rV  rV    ru  r   c                   d S r   r   r  s         r   rV  rV    rj  r   )r  r[  r\  r`  c                   d S r   r   r  s         r   rV  rV  )  rh  r   )r  r_  r\  r`  c                   d S r   r   r  s         r   rV  rV  5  rh  r   )r  r[  r_  r\  c                   d S r   r   r  s         r   rV  rV  A  ru  r   )r  r[  r_  r`  c                   d S r   r   r  s         r   rV  rV  M  rr  r   r  r[  r_  r\  r`  c                   d S r   r   r  s         r   rV  rV  Y  ru  r   F)r_  r   r  c                   d S r   r   r  s         r   rV  rV  f  s	     #r   )r^  r  r[  r_  r\  r`  5IntoFrameT | IntoFrame | IntoSeriesT | IntoSeries | TGLazyFrame[IntoFrameT] | DataFrame[IntoFrameT] | Series[IntoSeriesT] | Tc          	     >   t          | t          t          f          r|s| S t          | t                    r|s|r| S t	          ||dd          }|r.dt          t          |                    }t          |          t          | |||||t          j
                  S )a	  Convert `native_object` to Narwhals Dataframe, Lazyframe, or Series.

    Arguments:
        native_object: Raw object from user.
            Depending on the other arguments, input object can be

            - a Dataframe / Lazyframe / Series supported by Narwhals (pandas, Polars, PyArrow, ...)
            - an object which implements `__narwhals_dataframe__`, `__narwhals_lazyframe__`,
              or `__narwhals_series__`
        strict: Determine what happens if the object can't be converted to Narwhals

            - `True` or `None` (default): raise an error
            - `False`: pass object through as-is

            *Deprecated* (v1.13.0)

            Please use `pass_through` instead. Note that `strict` is still available
            (and won't emit a deprecation warning) if you use `narwhals.stable.v1`,
            see [perfect backwards compatibility policy](../backcompat.md/).
        pass_through: Determine what happens if the object can't be converted to Narwhals

            - `False` or `None` (default): raise an error
            - `True`: pass object through as-is
        eager_only: Whether to only allow eager objects

            - `False` (default): don't require `native_object` to be eager
            - `True`: only convert to Narwhals if `native_object` is eager
        eager_or_interchange_only: Whether to only allow eager objects or objects which
            have interchange-level support in Narwhals

            - `False` (default): don't require `native_object` to either be eager or to
              have interchange-level support in Narwhals
            - `True`: only convert to Narwhals if `native_object` is eager or has
              interchange-level support in Narwhals

            See [interchange-only support](../extending.md/#interchange-only-support)
            for more details.
        series_only: Whether to only allow Series

            - `False` (default): don't require `native_object` to be a Series
            - `True`: only convert to Narwhals if `native_object` is a Series
        allow_series: Whether to allow Series (default is only Dataframe / Lazyframe)

            - `False` or `None` (default): don't convert to Narwhals if `native_object` is a Series
            - `True`: allow `native_object` to be a Series

    Returns:
        DataFrame, LazyFrame, Series, or original object, depending
            on which combination of parameters was passed.
    Fpass_through_defaultemit_deprecation_warningz1from_native() got an unexpected keyword argument )r  r[  r_  r\  r`  version)r   r"   r#   r.   r!   nextiterr   rL   r   ry   )	rR  r^  r  r[  r_  r\  r`  rS  r   s	            r   rV  rV  r  s    | -)Y!788  -(( k \ 25SX  L  V$tDzzBRBRVVnn!";!
   r   )r^  narwhals_objectc                   d S r   r   r  r^  s     r   	to_nativer    	     Sr   c                   d S r   r   r  s     r   r  r    	     r   c                   d S r   r   r  s     r   r  r    	     #r   c                   d S r   r   r  s     r   r  r    s    =@Sr   r  c                   d S r   r   r  r  s     r   r  r    r  r   c                   d S r   r   r  s     r   r  r    r  r   c                   d S r   r   r  s     r   r  r    r  r   c                   d S r   r   r  s     r   r  r    rG  r   )r^  r  GDataFrame[IntoDataFrameT] | LazyFrame[IntoFrameT] | Series[IntoSeriesT]IntoFrameT | IntoSeriesT | Anyc                   ddl m} ddlm} ddlm}  |||dd          }t          | |          r| j        j        S t          | |          r| j	        j
        S |s"dt          |            d}t          |          | S )	a,  Convert Narwhals object to native one.

    Arguments:
        narwhals_object: Narwhals object.
        strict: Determine what happens if `narwhals_object` isn't a Narwhals class

            - `True` (default): raise an error
            - `False`: pass object through as-is

            *Deprecated* (v1.13.0)

            Please use `pass_through` instead. Note that `strict` is still available
            (and won't emit a deprecation warning) if you use `narwhals.stable.v1`,
            see [perfect backwards compatibility policy](../backcompat.md/).
        pass_through: Determine what happens if `narwhals_object` isn't a Narwhals class

            - `False` (default): raise an error
            - `True`: pass object through as-is

    Returns:
        Object of class that user started with.
    r   r!   r   r-   Fr  zExpected Narwhals object, got .)r  r!   r   r   r   r.   r   r   _native_framerO  nativer   r   )r  r^  r  r!   r   r.   r   s          r   r  r    s    < @?????,,,,,,&&&&&&225SX  L /9-- >/==/6** 8077 GtO/D/DGGGnnr   TfuncCallable[..., Any] | NoneCallable[..., Any]c               d    t          |dd          d	fd}| |S  ||           S )
a	  Decorate function so it becomes dataframe-agnostic.

    This will try to convert any dataframe/series-like object into the Narwhals
    respective DataFrame/Series, while leaving the other parameters as they are.
    Similarly, if the output of the function is a Narwhals DataFrame or Series, it will be
    converted back to the original dataframe/series type, while if the output is another
    type it will be left as is.
    By setting `pass_through=False`, then every input and every output will be required to be a
    dataframe/series-like object.

    Arguments:
        func: Function to wrap in a `from_native`-`to_native` block.
        strict: Determine what happens if the object can't be converted to Narwhals

            *Deprecated* (v1.13.0)

            Please use `pass_through` instead. Note that `strict` is still available
            (and won't emit a deprecation warning) if you use `narwhals.stable.v1`,
            see [perfect backwards compatibility policy](../backcompat.md/).

            - `True` or `None` (default): raise an error
            - `False`: pass object through as-is
        pass_through: Determine what happens if the object can't be converted to Narwhals

            - `False` or `None` (default): raise an error
            - `True`: pass object through as-is
        eager_only: Whether to only allow eager objects

            - `False` (default): don't require `native_object` to be eager
            - `True`: only convert to Narwhals if `native_object` is eager
        eager_or_interchange_only: Whether to only allow eager objects or objects which
            have interchange-level support in Narwhals

            - `False` (default): don't require `native_object` to either be eager or to
              have interchange-level support in Narwhals
            - `True`: only convert to Narwhals if `native_object` is eager or has
              interchange-level support in Narwhals

            See [interchange-only support](../extending.md/#interchange-only-support)
            for more details.
        series_only: Whether to only allow Series

            - `False` (default): don't require `native_object` to be a Series
            - `True`: only convert to Narwhals if `native_object` is a Series
        allow_series: Whether to allow Series (default is only Dataframe / Lazyframe)

            - `False` or `None`: don't convert to Narwhals if `native_object` is a Series
            - `True` (default): allow `native_object` to be a Series

    Returns:
        Decorated function.
    TFr  r  r  rr   c                J     t                     d fd            }|S )Nargsr   r   rr   c                 @   
fd| D             } 
fd|                                 D             }fdg | |                                R D             }|                                dk    rd}t          |           	| i |}t	          |
          S )Nc           
     :    g | ]}t          |           S r  rV  ).0r   r`  r[  r_  r  r\  s     r   
<listcomp>zBnarwhalify.<locals>.decorator.<locals>.wrapper.<locals>.<listcomp>[  sL     
 
 
  !-).G +!-  
 
 
r   c                B    i | ]\  }}|t          |           S r  r  )r  r   valuer`  r[  r_  r  r\  s      r   
<dictcomp>zBnarwhalify.<locals>.decorator.<locals>.wrapper.<locals>.<dictcomp>g  sR     
 
 
  D% k!-).G +!-  
 
 
r   c                J    h | ]}t          |d d          x              S )__native_namespace__N)getattr)r  vbs     r   	<setcomp>zAnarwhalify.<locals>.decorator.<locals>.wrapper.<locals>.<setcomp>s  sG        $:DAAAA  r      z_Found multiple backends. Make sure that all dataframe/series inputs come from the same backend.r  )itemsvalues__len__
ValueErrorr  )r  r   backendsr   resultr  r`  r[  r_  r  r  r\  s        @r   wrapperz.narwhalify.<locals>.decorator.<locals>.wrapperY  s   
 
 
 
 
 
 
 
  
 
 
D
 
 
 
 
 
 
 
 $*<<>>
 
 
F   242&--//22  H !!A%%w oo%T4*6**FV,????r   )r  r   r   r   rr   r   r   )r  r  r`  r[  r_  r  r\  s   ` r   	decoratorznarwhalify.<locals>.decoratorX  s^    	t%	@ %	@ %	@ %	@ %	@ %	@ %	@ %	@ %	@ %	@ 
%	@N r   N)r  r  rr   r  r  )r  r^  r  r[  r_  r\  r`  r  s     ````` r   
narwhalifyr    sx    | 34RW  L) ) ) ) ) ) ) ) ) )V | yr   c                 B    t          t          j                              S )z`Instantiate an expression representing all columns.

    Returns:
        A new expression.
    )r   nwr   r   r   r   r   r          bfhhr   namesstr | Iterable[str]c                 8    t          t          j        |            S )zCreates an expression that references one or more columns by their name(s).

    Arguments:
        names: Name(s) of the columns to use.

    Returns:
        A new expression.
    )r   r  r   r  s    r   r   r     s     bfen%%%r   c                 8    t          t          j        |            S )zCreates an expression that excludes columns by their name(s).

    Arguments:
        names: Name(s) of the columns to exclude.

    Returns:
        A new expression.
    )r   r  excluder  s    r   r  r    s     bj%()))r   indicesint | Sequence[int]c                 8    t          t          j        |            S )aI  Creates an expression that references one or more columns by their index(es).

    Notes:
        `nth` is not supported for Polars version<1.0.0. Please use
        [`narwhals.col`][] instead.

    Arguments:
        indices: One or more indices representing the columns to retrieve.

    Returns:
        A new expression.
    )r   r  nth)r  s    r   r  r    s     bfg&'''r   c                 B    t          t          j                              S )zGReturn the number of rows.

    Returns:
        A new expression.
    )r   r  lenr   r   r   r  r    r  r   r  r]   dtypeIntoDType | Nonec                F    t          t          j        | |                    S )a!  Return an expression representing a literal value.

    Arguments:
        value: The value to use as literal.
        dtype: The data type of the literal value. If not provided, the data type will
            be inferred by the native library.

    Returns:
        A new expression.
    )r   r  lit)r  r  s     r   r  r    s     bfUE**+++r   columnsr   c                 8    t          t          j        |            S )zReturn the minimum value.

    Note:
       Syntactic sugar for ``nw.col(columns).min()``.

    Arguments:
        columns: Name(s) of the columns to use in the aggregation function.

    Returns:
        A new expression.
    )r   r  minr  s    r   r  r         bfg&'''r   c                 8    t          t          j        |            S )zReturn the maximum value.

    Note:
       Syntactic sugar for ``nw.col(columns).max()``.

    Arguments:
        columns: Name(s) of the columns to use in the aggregation function.

    Returns:
        A new expression.
    )r   r  maxr  s    r   r  r    r  r   c                 8    t          t          j        |            S )zGet the mean value.

    Note:
        Syntactic sugar for ``nw.col(columns).mean()``

    Arguments:
        columns: Name(s) of the columns to use in the aggregation function

    Returns:
        A new expression.
    )r   r  meanr  s    r   r  r    s     bgw'(((r   c                 8    t          t          j        |            S )at  Get the median value.

    Notes:
        - Syntactic sugar for ``nw.col(columns).median()``
        - Results might slightly differ across backends due to differences in the
            underlying algorithms used to compute the median.

    Arguments:
        columns: Name(s) of the columns to use in the aggregation function

    Returns:
        A new expression.
    )r   r  medianr  s    r   r  r    s     bi)***r   c                 8    t          t          j        |            S )zSum all values.

    Note:
        Syntactic sugar for ``nw.col(columns).sum()``

    Arguments:
        columns: Name(s) of the columns to use in the aggregation function

    Returns:
        A new expression.
    )r   r  sumr  s    r   r  r    r  r   exprsIntoExpr | Iterable[IntoExpr]c                 8    t          t          j        |            S )a2  Sum all values horizontally across columns.

    Warning:
        Unlike Polars, we support horizontal sum over numeric columns only.

    Arguments:
        exprs: Name(s) of the columns to use in the aggregation function. Accepts
            expression input.

    Returns:
        A new expression.
    )r   r  sum_horizontalr  s    r   r  r         b'/000r   c                 8    t          t          j        |            S )zCompute the bitwise AND horizontally across columns.

    Arguments:
        exprs: Name(s) of the columns to use in the aggregation function. Accepts
            expression input.

    Returns:
        A new expression.
    )r   r  all_horizontalr  s    r   r  r  /       b'/000r   c                 8    t          t          j        |            S )zCompute the bitwise OR horizontally across columns.

    Arguments:
        exprs: Name(s) of the columns to use in the aggregation function. Accepts
            expression input.

    Returns:
        A new expression.
    )r   r  any_horizontalr  s    r   r  r  <  r  r   c                 8    t          t          j        |            S )zCompute the mean of all values horizontally across columns.

    Arguments:
        exprs: Name(s) of the columns to use in the aggregation function. Accepts
            expression input.

    Returns:
        A new expression.
    )r   r  mean_horizontalr  s    r   r  r  I  s     b(%0111r   c                 8    t          t          j        |            S )a*  Get the minimum value horizontally across columns.

    Notes:
        We support `min_horizontal` over numeric columns only.

    Arguments:
        exprs: Name(s) of the columns to use in the aggregation function. Accepts
            expression input.

    Returns:
        A new expression.
    )r   r  min_horizontalr  s    r   r  r  V  r  r   c                 8    t          t          j        |            S )a*  Get the maximum value horizontally across columns.

    Notes:
        We support `max_horizontal` over numeric columns only.

    Arguments:
        exprs: Name(s) of the columns to use in the aggregation function. Accepts
            expression input.

    Returns:
        A new expression.
    )r   r  max_horizontalr  s    r   r  r  f  r  r    	separatorignore_nulls
more_exprsrY   r  r  c               H    t          t          j        | g|R ||d          S )a  Horizontally concatenate columns into a single string column.

    Arguments:
        exprs: Columns to concatenate into a single string column. Accepts expression
            input. Strings are parsed as column names, other non-expression inputs are
            parsed as literals. Non-`String` columns are cast to `String`.
        *more_exprs: Additional columns to concatenate into a single string column,
            specified as positional arguments.
        separator: String that will be used to separate the values of each column.
        ignore_nulls: Ignore null values (default is `False`).
            If set to `False`, null values will be propagated and if the row contains any
            null values, the output is null.

    Returns:
        A new expression.
    r  )r   r  
concat_str)r  r  r  r  s       r   r
  r
  v  s5    , 
eYjYYILYYY  r   c                  8     e Zd Zed	d            Zd
 fdZ xZS )Whenwhen	nw_f.Whenrr   c                "     | |j                   S r   )
_predicate)clsr  s     r   	from_whenzWhen.from_when  s    s4?###r   r  &IntoExpr | NonNestedLiteral | _1DArrayThenc                v    t                               t                                          |                    S r   )r  	from_thenrz   thenr}   r  r~   s     r   r  z	When.then  s%    ~~eggll511222r   )r  r  rr   r  )r  r  rr   r  )r   r   r   classmethodr  r  r   r   s   @r   r  r    s[        $ $ $ [$3 3 3 3 3 3 3 3 3 3r   r  c                  8     e Zd Zed	d            Zd
 fdZ xZS )r  r  	nw_f.Thenrr   c                .     | |j         |j                  S r   )r   rP  )r  r  s     r   r  zThen.from_then  s    s4*DN;;;r   r  r  r'   c                `    t          t                                          |                    S r   )r   rz   	otherwiser  s     r   r  zThen.otherwise  s#    %''++E22333r   )r  r  rr   r  )r  r  rr   r'   )r   r   r   r  r  r  r   r   s   @r   r  r    s[        < < < [<4 4 4 4 4 4 4 4 4 4r   r  
predicatesc                 N    t                               t          j        |            S )a  Start a `when-then-otherwise` expression.

    Expression similar to an `if-else` statement in Python. Always initiated by a
    `pl.when(<condition>).then(<value if condition>)`, and optionally followed by a
    `.otherwise(<value if condition is false>)` can be appended at the end. If not
    appended, and the condition is not `True`, `None` will be returned.

    Info:
        Chaining multiple `.when(<condition>).then(<value>)` statements is currently
        not supported.
        See [Narwhals#668](https://github.com/narwhals-dev/narwhals/issues/668).

    Arguments:
        predicates: Condition(s) that must be met in order to apply the subsequent
            statement. Accepts one or more boolean expressions, which are implicitly
            combined with `&`. String input is parsed as a column name.

    Returns:
        A "when" object, which `.then` can be called on.
    )r  r  nw_fr  )r  s    r   r  r    s    * >>$)Z0111r   )required)r   native_namespacer   r  r   r   r#  ModuleType | Nonec               b    t          d|          }t          t          | |||                    S )aP  Instantiate Narwhals Series from iterable (e.g. list or array).

    Arguments:
        name: Name of resulting Series.
        values: Values of make Series from.
        dtype: (Narwhals) dtype. If not provided, the native library
            may auto-infer it from `values`.
        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`.
        native_namespace: The native library to use for DataFrame creation.

            *Deprecated* (v1.31.0)

            Please use `backend` instead. Note that `native_namespace` is still available
            (and won't emit a deprecation warning) if you use `narwhals.stable.v1`,
            see [perfect backwards compatibility policy](../backcompat.md/).

    Returns:
        A new Series
    !ModuleType | Implementation | strr   )r   r   r(   )r   r  r  r   r#  s        r   
new_seriesr'    s5    F 6@@G&tVUGLLLMMMr   native_framerT   c               h    t          d|          }t          t          j        | |                    S )a  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`.
        native_namespace: The native library to use for DataFrame creation.

            *Deprecated* (v1.31.0)

            Please use `backend` instead. Note that `native_namespace` is still available
            (and won't emit a deprecation warning) if you use `narwhals.stable.v1`,
            see [perfect backwards compatibility policy](../backcompat.md/).

    Returns:
        A new DataFrame.
    r&  r   )r   r   r!  
from_arrow)r(  r   r#  s      r   r*  r*    s1    < 6@@GdolGDDDEEEr   dataMapping[str, Any]r7  #Mapping[str, DType] | Schema | Nonec               J    t          t          j        | ||                    S )as  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`.
        native_namespace: The native library to use for DataFrame creation.

            *Deprecated* (v1.26.0)

            Please use `backend` instead. Note that `native_namespace` is still available
            (and won't emit a deprecation warning) if you use `narwhals.stable.v1`,
            see [perfect backwards compatibility policy](../backcompat.md/).

    Returns:
        A new DataFrame.
    r   )r   r!  	from_dictr+  r7  r   r#  s       r   r/  r/    s$    R dnT67CCCDDDr   ra   3Mapping[str, DType] | Schema | Sequence[str] | Nonec               j    t          d|          }t          t          j        | ||                    S )a  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`.
        native_namespace: The native library to use for DataFrame creation.

            *Deprecated* (v1.31.0)

            Please use `backend` instead. Note that `native_namespace` is still available
            (and won't emit a deprecation warning) if you use `narwhals.stable.v1`,
            see [perfect backwards compatibility policy](../backcompat.md/).

    Returns:
        A new DataFrame.
    r&  r   )r   r   r!  
from_numpyr0  s       r   r3  r3  0  s4    L 6@@GdodFGDDDEEEr   sourcer   c               d    t          d|          }t          t          j        | fd|i|          S )aJ  Read a CSV file into a DataFrame.

    Arguments:
        source: Path to a file.
        backend: The eager backend for DataFrame creation.
            `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`.
        native_namespace: The native library to use for DataFrame creation.

            *Deprecated* (v1.27.2)

            Please use `backend` instead. Note that `native_namespace` is still available
            (and won't emit a deprecation warning) if you use `narwhals.stable.v1`,
            see [perfect backwards compatibility policy](../backcompat.md/).
        kwargs: Extra keyword arguments which are passed to the native CSV reader.
            For example, you could use
            `nw.read_csv('file.csv', backend='pandas', engine='pyarrow')`.

    Returns:
        DataFrame.
    r&  r   )r   r   r!  read_csvr4  r   r#  r   s       r   r6  r6  Z  s:    B 6@@GdmFFFGFvFFGGGr   c               d    t          d|          }t          t          j        | fd|i|          S )a  Lazily read from a CSV file.

    For the libraries that do not support lazy dataframes, the function reads
    a csv file eagerly and then converts the resulting dataframe to a lazyframe.

    Arguments:
        source: Path to a file.
        backend: The eager backend for DataFrame creation.
            `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`.
        native_namespace: The native library to use for DataFrame creation.

            *Deprecated* (v1.31.0)

            Please use `backend` instead. Note that `native_namespace` is still available
            (and won't emit a deprecation warning) if you use `narwhals.stable.v1`,
            see [perfect backwards compatibility policy](../backcompat.md/).
        kwargs: Extra keyword arguments which are passed to the native CSV reader.
            For example, you could use
            `nw.scan_csv('file.csv', backend=pd, engine='pyarrow')`.

    Returns:
        LazyFrame.
    r&  r   )r   r   r!  scan_csvr7  s       r   r9  r9    s:    H 6@@GdmFFFGFvFFGGGr   c               d    t          d|          }t          t          j        | fd|i|          S )aY  Read into a DataFrame from a parquet file.

    Arguments:
        source: Path to a file.
        backend: The eager backend for DataFrame creation.
            `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`.
        native_namespace: The native library to use for DataFrame creation.

            *Deprecated* (v1.31.0)

            Please use `backend` instead. Note that `native_namespace` is still available
            (and won't emit a deprecation warning) if you use `narwhals.stable.v1`,
            see [perfect backwards compatibility policy](../backcompat.md/).
        kwargs: Extra keyword arguments which are passed to the native parquet reader.
            For example, you could use
            `nw.read_parquet('file.parquet', backend=pd, engine='pyarrow')`.

    Returns:
        DataFrame.
    r&  r   )r   r   r!  read_parquetr7  s       r   r;  r;    s;    B 6@@Gd'JJJ6JJKKKr   c               d    t          d|          }t          t          j        | fd|i|          S )a  Lazily read from a parquet file.

    For the libraries that do not support lazy dataframes, the function reads
    a parquet file eagerly and then converts the resulting dataframe to a lazyframe.

    Note:
        Spark like backends require a session object to be passed in `kwargs`.

        For instance:

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

        nw.scan_parquet(source, backend="sqlframe", session=DuckDBSession())
        ```

    Arguments:
        source: Path to a file.
        backend: The eager backend for DataFrame creation.
            `backend` can be specified in various ways

            - As `Implementation.<BACKEND>` with `BACKEND` being `PANDAS`, `PYARROW`,
                `POLARS`, `MODIN`, `CUDF`, `PYSPARK` or `SQLFRAME`.
            - As a string: `"pandas"`, `"pyarrow"`, `"polars"`, `"modin"`, `"cudf"`,
                `"pyspark"` or `"sqlframe"`.
            - Directly as a module `pandas`, `pyarrow`, `polars`, `modin`, `cudf`,
                `pyspark.sql` or `sqlframe`.
        native_namespace: The native library to use for DataFrame creation.

            *Deprecated* (v1.31.0)

            Please use `backend` instead. Note that `native_namespace` is still available
            (and won't emit a deprecation warning) if you use `narwhals.stable.v1`,
            see [perfect backwards compatibility policy](../backcompat.md/).
        kwargs: Extra keyword arguments which are passed to the native parquet reader.
            For example, you could use
            `nw.scan_parquet('file.parquet', backend=pd, engine='pyarrow')`.

    Returns:
        LazyFrame.
    r&  r   )r   r   r!  scan_parquetr7  s       r   r=  r=    s;    d 6@@Gd'JJJ6JJKKKr   )Pr0   r1   r2   r3   r"   r4   r5   r6   r7   r8   r'   r9   r:   r;   r   r<   r=   r>   r?   r@   r#   rA   rB   r,   r.   rC   rD   rE   rF   rG   rH   rI   rJ   rK   r   r  r  r   r)   r
  r   r/   r   r  r*  r/  rV  r3  r   r*   rM   r   r  r  r  r  r   r   r   r   r    r  r  r  r  r  r  r'  r  r6  r;  r9  r=  r   r+   r  r  r  rN   r  )r;  r<  rr   r=  )r;  rA  rr   rB  )r;  rD  rr   rE  )r;  rH  rr   r'   )r;  rJ  rr   rK  )rR  rg   rS  r   rr   rg   )rR  rb   rS  r   rr   rb   )rR  re   rS  r   rr   re   )rR  rY  rS  r   rr   rY  )rR  r]  r^  r   r[  r   r_  r   r\  r   r`  r   rr   ra  )rR  r]  r^  r   r[  r   r_  r   r\  r   r`  r   rr   ra  )rR  rO   r^  r   r[  r   r_  r   r\  r   r`  rs   rr   rf  )rR  ri   r^  r   r[  r   r_  r   r\  r   r`  rs   rr   ri   )rR  rO   r^  r   r[  r   r_  r   r\  r   r`  rs   rr   rf  )rR  ri   r^  r   r[  r   r_  r   r\  r   r`  rs   rr   ri   )rR  rm  r^  r   r[  r   r_  r   r\  r   r`  r   rr   rn  )rR  rm   r^  r   r[  r   r_  r   r\  r   r`  rs   rr   rE  )rR  rP   r^  r   r[  r   r_  r   r\  r   r`  rs   rr   rs  )rR  ri   r^  r   r[  r   r_  r   r\  r   r`  rs   rr   ri   )rR  rO   r^  r   r[  r   r_  r   r\  r   r`  rs   rr   rf  )rR  rO   r^  r   r[  r   r_  r   r\  r   r`  rs   rr   rf  )rR  ry  r^  r   r[  r   r_  r   r\  r   r`  r   rr   rz  )rR  rm   r^  r   r[  r   r_  r   r\  r   r`  rs   rr   rE  )rR  r[   r^  r   r[  r   r_  r   r\  r   r`  rs   rr   r}  )rR  rP   r^  r   r[  r   r_  r   r\  r   r`  rs   rr   rs  )rR  r  r  r   r[  r   r_  r   r\  r   r`  r   rr   rf  )rR  r]  r  r   r[  r   r_  r   r\  r   r`  r   rr   ra  )rR  rO   r  r   r[  r   r_  r   r\  r   r`  rs   rr   rf  )rR  ri   r  r   r[  r   r_  r   r\  r   r`  rs   rr   ri   )rR  rO   r  r   r[  r   r_  r   r\  r   r`  rs   rr   rf  )rR  ri   r  r   r[  r   r_  r   r\  r   r`  rs   rr   ri   )rR  rm  r  r   r[  r   r_  r   r\  r   r`  r   rr   rn  )rR  rm   r  r   r[  r   r_  r   r\  r   r`  rs   rr   rE  )rR  rP   r  r   r[  r   r_  r   r\  r   r`  rs   rr   rs  )rR  ri   r  r   r[  r   r_  r   r\  r   r`  rs   rr   ri   )rR  rO   r  r   r[  r   r_  r   r\  r   r`  rs   rr   rf  )rR  rO   r  r   r[  r   r_  r   r\  r   r`  rs   rr   rf  )rR  ry  r  r   r[  r   r_  r   r\  r   r`  r   rr   rz  )rR  rm   r  r   r[  r   r_  r   r\  r   r`  rs   rr   rE  )rR  rP   r  r   r[  r   r_  r   r\  r   r`  rs   rr   rs  )rR  r   r  r   r[  r   r_  r   r\  r   r`  r  rr   r   )rR  r  r^  r  r  r  r[  r   r_  r   r\  r   r`  r  rS  r   rr   r  )r  rf  r^  r   rr   rO   )r  rB  r^  r   rr   rP   )r  rE  r^  r   rr   rm   )r  r   r^  r   rr   r   )r  rf  r  r   rr   rO   )r  rB  r  r   rr   rP   )r  rE  r  r   rr   rm   )r  r   r  r   rr   r   )r  r  r^  r  r  r  rr   r  r   )r  r  r^  r  r  r  r[  r   r_  r   r\  r   r`  r  rr   r  )rr   r'   )r  r  rr   r'   )r  r  rr   r'   )r  r]   r  r  rr   r'   )r  r   rr   r'   )r  r  rr   r'   )
r  r  r  rY   r  r   r  r   rr   r'   )r  r  rr   r  )r   r   r  r   r  r  r   r   r#  r$  rr   rh   )r(  rT   r   r   r#  r$  rr   rc   )
r+  r,  r7  r-  r   r   r#  r$  rr   rc   )
r+  ra   r7  r1  r   r   r#  r$  rr   rc   )
r4  r   r   r   r#  r$  r   r   rr   rc   )
r4  r   r   r   r#  r$  r   r   rr   rf   )
__future__r   	functoolsr   typingr   r   r   r	   r
   r   r   r   r   warningsr   narwhalsr  r   r   r   r!  r   narwhals._typing_compatr   r  r   r   r   r   r   r   r   r   r   r   r   r    r!   r   r"   r   r#   r   narwhals.dependenciesr$   r  r%   r   r'   rH  narwhals.functionsr(   r)   r*   r+   narwhals.schemar,   r:  r   r.   r
  narwhals.stable.v1r/   narwhals.stable.v1.dtypesr0   r1   r2   r3   r4   r5   r6   r7   r8   r9   r:   r;   r<   r=   r>   r?   r@   rA   rB   rC   rD   rE   rF   rG   rH   rI   rJ   rK   narwhals.translaterL   rM   rN   narwhals.typingrO   rP   typesrQ   typing_extensionsrR   rS   narwhals._translaterT   rU   rV   narwhals.dtypesrW   rX   rY   rZ   r[   r\   r]   r^   r_   r`   ra   rb   re   rg   ri   rk   rl   rm   r   rV  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/  r3  r6  r9  r;  r=  __all__r   r   r   <module>rP     s   " " " " " "      
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
           K K K K K K K K K K K K + + + + + +                              R Q Q Q Q Q Q Q , , , , , , 4 4 4 4 4 4 ( ( ( ( ( ( Q Q Q Q Q Q Q Q Q Q Q Q . . . . . . . . . . . . % % % % % %                                                           < U T T T T T T T T T 6 6 6 6 6 6 6 6       11111111222222GGGGGGGG%%%%%%                        -=>>>J-=>>>Jgi}555GS!!!A	#AAgm<EEES- S- S- S- S-N+ S- S- S-lJ
 J
 J
 J
 J
J' J
 J
 J
Z3
 3
 3
 3
 3
Xk" 3
 3
 3
lq
 q
 q
 q
 q
6 q
 q
 q
h! ! ! ! !X ! ! ! 
 J J J 
 J	 J J J 
 J	 F F F 
 F	 ( ( ( 
 (   $ 
 D D D 
 D 
 J J J 
 J 
 J J J 
 J 
" " " 
"
 

 "%"%: : : : : 
: 
 14"%: : : : : 
: 

 "%"%$ $ $ $ $ 
$ 

 "%"%     
 
 14"%$ $ $ $ $ 
$ 
 14"%     
 

 "%03"%N N N N N 
N 

 "%03     
 

 "%03"%8 8 8 8 8 
8 

 "%03"%     
 
  !$"%$ $ $ $ $ 
$ 
  03"%$ $ $ $ $ 
$ 
  !$03"%8 8 8 8 8 
8 
  !$03     
 
  !$03"%$ $ $ $ $ 
$ 
  !$03"%8 8 8 8 8 
8 

 "%"%$ $ $ $ $ 
$ 
 14"%: : : : : 
: 

 "%"%$ $ $ $ $ 
$ 

 "%"%     
 
 14"%$ $ $ $ $ 
$ 
 14"%     
 

 "%03"%N N N N N 
N 

 "%03     
 

 "%03"%8 8 8 8 8 
8 

 "%03"%     
 
 $'!$"%$ $ $ $ $ 
$ 
 $'03"%$ $ $ $ $ 
$ 
 $'!$03"%8 8 8 8 8 
8 
 $'!$03     
 
 $'!$03"%8 8 8 8 8 
8 
 ',     
  $&+ $R R R R R Rj 
KN     
 
GJ     
 
EH     
 
 @ @ @ 
 @	RU     
 
NQ     
 
LO     
 
 F F F 
 F  $. . . . . .d '+q  $&+ $q q q q q qh       	& 	& 	& 	&	* 	* 	* 	*( ( ( (        , , , , ,( ( ( (( ( ( () ) ) )+ + + +"( ( ( (1 1 1 1 
1 
1 
1 
1
1 
1 
1 
1
2 
2 
2 
21 1 1 1 1 1 1 1& 	     63 3 3 3 349 3 3 34 4 4 4 449d 4 4 42 2 2 20 T*** ##N
 9=*.#N #N #N #N #N +*#NL T*** 9=*.	F F F F F +*FB  37(E 9=*.(E (E (E (E (E (EV T*** CG&F 9=*.&F &F &F &F &F +*&FR T*** 9=*.	!H !H !H !H !H +*!HH T*** 9=*.	$H $H $H $H $H +*$HN T*** 9=*.	!L !L !L !L !L +*!LH T*** 9=*.	2L 2L 2L 2L 2L +*2LjQ Q Qr   