
    h                   $   S SK Jr  S SKJr  S SKJr  S SKJr  S SKJr  S SKJr  S SKJ	r	  S SKJ
r
  S S	KJr  S S
KJr  S SKJr  S SKrS SKJr  S SKJr  S SKJr  S SKJr  S SKJr  S SKJr  S SKJr  S SKJr  S SKJ r!  S SK"J#r$  S SK"J%r&  S SK"J'r'  S SK"J(r(  S SK"J)r)  S SK"J*r*  S SK"J+r+  S SK"J,r,  S SK"J-r-  S SK"J.r.  S S K"J/r/  S S!K"J0r0  S S"K"J1r2  S S#K3J4r5  S S$K6J7r8  S S%K9J:r:  S S&K;J<r<  S S'K;J=r=  S S(K;J>r>  S S)K;J?r?  S S*K;J@r@  S S+K;JArA  S S,K;JBrB  S S-K;JCrC  S S.K;JDrD  S S/K;JErE  S S0K;JFrF  S S1K;JGrG  S S2K;JHrH  S S3K;JIrI  S S4K;JJrJ  S S5K;JKrK  S S6K;JLrL  S S7K;JMrM  S S8K;JNrN  S S9K;JOrO  S S:K;JPrP  S S;K;JQrQ  S S<K;JRrR  S S=K;JSrS  S S>K;JTrT  S S?K;JUrU  S S@K;JVrV  S SAK;JWrW  S SBKXJYrY  S SCKXJZrZ  S SDKXJ[r[  S SEK\J]r]  S SFK\J^r^  S SGK_J`r`  S SHK_Jara  S SIK_Jbrb  S SJK_Jcrc  S SKK_Jdrd  S SLK_Jere  S SMK_Jfrf  S SNK_Jgrg  S SOK_Jhrh  S SPK_Jiri  S SQK_Jjrj  S SRK_Jkrk  \(       a  S SSKlJmrm  S STKJnrn  S SUKoJprp  S SVKoJqrq  S SWKrJsrs  S SXKJtrt  S SYKJuru  S SZKvJwrw  S S[K\Jxrx  S S\K\Jyry  S S]K\Jzrz  S S^K\J{r{  S S_K\J|r|  S S`K\J}r}  S SaK\J~r~  S SbK\Jr  S ScK\Jr  S SdK\Jr  \q" SeSfSg5      r\q" ShSfSi9r\q" SjSgSi9r\q" SkSlSi9r\q" SmSn\So9r\q" Sp\Sq9rOS SVKJqrq  \q" SmSnSi9r\q" Sp5      r " Sr Ss\\]   5      r " St Su\\^   5      r " Sv Sw\8\   5      r7 " Sx Sy\!5      r  " Sz S{\55      r4\SS| j5       r\SS} j5       r\SS~ j5       r\SS j5       r\SS j5       r    SS jr\SS j5       r\SS j5       r\SS j5       r\      SS j5       r\SSS.             SS jj5       r\SSS.             SS jj5       r\SSSS.             SS jj5       r\SSSS.             SS jj5       r\SSSS.             SS jj5       r\SSSS.             GS S jj5       r\SSSS.             GSS jj5       r\SSSS.             GSS jj5       r\SSSSS.             GSS jj5       r\SSSSS.             GSS jj5       r\SSSSS.             GSS jj5       r\SSSSS.             GSS jj5       r\SSSSS.             GSS jj5       r\SSSSS.             GSS jj5       r\SSSSSS.             GS	S jj5       r\SSSSSS.             GS
S jj5       r\SSS.             GSS jj5       r\SSS.             GSS jj5       r\SSSS.             GSS jj5       r\SSSS.             GSS jj5       r\SSSS.             GSS jj5       r\SSSS.             GSS jj5       r\SSSS.             GSS jj5       r\SSSS.             GSS jj5       r\SSSSS.             GSS jj5       r\SSSSS.             GSS jj5       r\SSSSS.             GSS jj5       r\SSSSS.             GSS jj5       r\SSSSS.             GSS jj5       r\SSSSS.             GSS jj5       r\SSSSSS.             GSS jj5       r\SS.             GSS jj5       rSSSSSSS.                 GSS jjr\SS.     GSS jj5       r\SS.     GSS jj5       r\SS.     GSS jj5       r\GSS j5       r\SS.     GS S jj5       r\SS.     GS!S jj5       r\SS.     GS"S jj5       r\GS#S j5       rSSS.       GS$S jjr GS%SSSSSSS.               GS&S jjjrGS'S jrGS(S jrGS(S jrGS)S jrGS'S jrGS%GS*S jjrGS+S jrGS+S jrGS+S jrGS+S jrGS+S jrGS,S jrGS,S jrGS,S jrGS,S jrGS,S jrGS,S jrSS.GS-S jjrSSS.         GS.S jjr " S S\&5      r% " S S\$\ 5      r#GS/S jr1\b" SS9 GS%SSS.           GS0S jjj5       r\b" SS9SSS.       GS1S jj5       r\b" 5        GS%SSS.         GS2S jjj5       r\b" SS9 GS%SSS.         GS3S jjj5       r\b" SS9SSS.         GS4S jj5       r\b" SS9SSS.         GS5S jj5       r\b" SS9SSS.         GS4S jj5       r\b" SS9SSS.         GS5S jj5       r/ SQrg(6      )annotationswraps)TYPE_CHECKING)Any)Callable)Iterable)Literal)Sequence)cast)overload)warnN)dependencies)
exceptions)	selectors)ExprKind	DataFrame	LazyFrame)
get_polars)InvalidIntoExprErrorExpr)Then)When)_from_arrow_impl)_from_dict_impl)_from_numpy_impl)_new_series_impl)_read_csv_impl)_read_parquet_impl)_scan_csv_impl)_scan_parquet_impl)	get_level)show_versions)when)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)Implementation)Version)deprecate_native_namespacefind_stacklevel)generate_temporary_column_name)is_ordered_categorical)maybe_align_index)maybe_convert_dtypes)maybe_get_index)maybe_reset_index)maybe_set_indexvalidate_strict_and_pass_though)
ModuleType)Mapping)Self)TypeVar)IntoArrowTable)MultiColSelector)MultiIndexSelector)DType)ConcatMethod)IntoExpr)	IntoFrame)IntoLazyFrameT)
IntoSeries)NonNestedLiteral)SingleColSelector)SingleIndexSelector)_1DArray)_2DArrayFrameTDataFrame[Any]LazyFrame[Any]
DataFrameT)bound
LazyFrameTSeriesTSeries[Any]IntoSeriesTrg   )rq   defaultT)rv   c                  \  ^  \ rS rSrSr\SS j5       r\SS j5       r\SS j5       r	\    SS j5       r	\    SS j5       r	    SU 4S jjr	 S   SU 4S	 jjjr
\S
S.SS jj5       r\SS j5       r\    SS j5       rSS.   SU 4S jjjrS U 4S jjrS U 4S jjrS!S jrSrU =r$ )"r   y   a2  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),
        )
        ```
c                    [         $ Nr)   selfs    M/var/www/html/env/lib/python3.13/site-packages/narwhals/stable/v1/__init__.py_seriesDataFrame._series   s        c                    [         $ r{   r   r|   s    r~   
_lazyframeDataFrame._lazyframe       r   c                    g r{    r}   items     r~   __getitem__DataFrame.__getitem__   s    WZr   c                    g r{   r   r   s     r~   r   r      s     r   c                    g r{   r   r   s     r~   r   r      s     r   c                "   > [         TU ]  U5      $ r{   )superr   )r}   r   	__class__s     r~   r   r      s     w"4((r   c                   > [         TU ]  US9$ )a  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.

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`
            or `POLARS`.
        - As a string: `"dask"`, `"duckdb"` or `"polars"`
        - Directly as a module `dask.dataframe`, `duckdb` or `polars`.

Returns:
    A new LazyFrame.
)backend)r   lazy)r}   r   r   s     r~   r   DataFrame.lazy   s    < w|G|,,r   .	as_seriesc                   g r{   r   r}   r   s     r~   to_dictDataFrame.to_dict   s    TWr   c                   g r{   r   r   s     r~   r   r      s    MPr   c                   g r{   r   r   s     r~   r   r      s     9<r   Tc                  > [         TU ]  US9$ )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.

Returns:
    A mapping from column name to values / Series.
r   )r   r   )r}   r   r   s     r~   r   r      s     w33r   c                    > [         TU ]  5       $ )zQGet a mask of all duplicated rows in this DataFrame.

Returns:
    A new Series.
)r   is_duplicatedr}   r   s    r~   r   DataFrame.is_duplicated   s     w$&&r   c                    > [         TU ]  5       $ )zMGet a mask of all unique rows in this DataFrame.

Returns:
    A new Series.
)r   	is_uniquer   s    r~   r   DataFrame.is_unique   s     w ""r   c                P    U R                  [        5       R                  5       5      $ )zJPrivate, just used to test the stable API.

Returns:
    A new DataFrame.
selectall_l1_normr|   s    r~   r   DataFrame._l1_norm       {{35>>+,,r   r   )returnztype[Series[Any]])r   ztype[LazyFrame[Any]])r   z-tuple[SingleIndexSelector, SingleColSelector]r   r   )r   z2str | tuple[MultiIndexSelector, SingleColSelector]r   rt   )r   zSingleIndexSelector | MultiIndexSelector | MultiColSelector | tuple[SingleIndexSelector, MultiColSelector] | tuple[MultiIndexSelector, MultiColSelector]r   r]   )r   a  SingleIndexSelector | SingleColSelector | MultiColSelector | MultiIndexSelector | tuple[SingleIndexSelector, SingleColSelector] | tuple[SingleIndexSelector, MultiColSelector] | tuple[MultiIndexSelector, SingleColSelector] | tuple[MultiIndexSelector, MultiColSelector]r   zSeries[Any] | Self | Anyr{   )r   (ModuleType | Implementation | str | Noner   ro   )r   Literal[True]r   zdict[str, Series[Any]])r   Literal[False]r   zdict[str, list[Any]])r   boolr   z-dict[str, Series[Any]] | dict[str, list[Any]])r   rt   r   r]   )__name__
__module____qualname____firstlineno____doc__propertyr   r   r   r   r   r   r   r   r   __static_attributes____classcell__r   s   @r~   r   r   y   s<   6     Z ZF	  	:	 
	 	):) 
")" =A-9- 
- -D 47W WP P< <	6< < $(4 4	64 4'#- -r   r   c                     ^  \ rS rSrSr\S
S j5       rSS jr S     SU 4S jjjrSS jr	SSU 4S jjjr
SSS jjrS	rU =r$ )r   i  as  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                    [         $ r{   r   r|   s    r~   
_dataframeLazyFrame._dataframe  r   r   c                   SSK Jn  SSKJn  SSKJn  [        X5      (       a  UR                  $ [        X5      (       a  Sn[        U5      e[        X5      (       a  UR                  U R                  5       5      $ [        U[        5      (       a!  U R                  5       nUR                  U5      $ [        5       b2  S[        [        U5      5      ;   a  S[        U5       S3n[        U5      e[        R                   " [        U5      5      e)	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}   argr   r   r*   msgplxs          r~   _extract_compliantLazyFrame._extract_compliant!  s     	1&*c%%'''c""BCC. c  ))$*E*E*GHHc3--/C773<<#CS	N(B1$s) =7 7  C. "44T#Y??r   c                (   > [         TU ]  " SSU0UD6$ )aM  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)

Returns:
    DataFrame
r   r   )r   collect)r}   r   kwargsr   s      r~   r   LazyFrame.collect=  s    H w9w9&99r   c                P    U R                  [        5       R                  5       5      $ )zJPrivate, just used to test the stable API.

Returns:
    A new lazyframe.
r   r|   s    r~   r   LazyFrame._l1_normc  r   r   c                "   > [         TU ]  U5      $ )zGet the last `n` rows.

Arguments:
    n: Number of rows to return.

Returns:
    A subset of the LazyFrame of shape (n, n_columns).
)r   tail)r}   nr   s     r~   r   LazyFrame.tailk  s     w|Ar   c                R    U R                  U R                  R                  XS95      $ )zTake every nth row in the DataFrame and return as a new DataFrame.

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

Returns:
    The LazyFrame containing only the selected rows.
r   offset)_with_compliantr   gather_everyr}   r   r   s      r~   r   LazyFrame.gather_everyv  s.     ##!!...B
 	
r   r   r   ztype[DataFrame[Any]])r   r   r   r   r{   )r   r   r   r   r   rn   r   )   r   intr   r]   r   r   r   r   r   r   r]   )r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   s   @r~   r   r     sh    
  @< =A$:9$: $: 
	$: $:L-	 	
 
r   r   c                     ^  \ rS rSrSr\SS j5       rSU 4S jjrSSSSS.         SU 4S jjjr SSS	S
.       SU 4S jjjjr	Sr
U =r$ )r*   i  a  Narwhals Series, backed by a native series.

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

    - If the native object is a series from one of the supported backend (e.g.
        pandas.Series, polars.Series, pyarrow.ChunkedArray), you can use
        [`narwhals.from_native`][]:
        ```py
        narwhals.from_native(native_series, allow_series=True)
        narwhals.from_native(native_series, series_only=True)
        ```

    - If the object is a generic sequence (e.g. a list or a tuple of values), you can
        create a series via [`narwhals.new_series`][]:
        ```py
        narwhals.new_series(
            name=name,
            values=values,
            backend=narwhals.get_native_namespace(another_object),
        )
        ```
c                    [         $ r{   r   r|   s    r~   r   Series._dataframe  r   r   c                    > [         TU ]  5       $ )z[Convert to dataframe.

Returns:
    A DataFrame containing this Series as a single column.
)r   to_framer   s    r~   r   Series.to_frame  s     w!!r   FNsortparallelname	normalizec                   > [         TU ]  XX4S9$ )a  Count the occurrences of unique values.

Arguments:
    sort: Sort the output by count in descending order. If set to False (default),
        the order of the output is random.
    parallel: Execute the computation in parallel. Used for Polars only.
    name: Give the resulting count column a specific name; if `normalize` is True
        defaults to "proportion", otherwise defaults to "count".
    normalize: If true gives relative frequencies of the unique values

Returns:
    A DataFrame with two columns:
    - The original values as first column
    - Either count or proportion as second column, depending on normalize parameter.
r   )r   value_counts)r}   r   r   r   r   r   s        r~   r   Series.value_counts  s!    . w#t $ 
 	
r   T)	bin_countinclude_breakpointc               \   > SSK Jn  SSKJn  Sn[	        XdU" 5       S9  [
        TU ]  UUUS9$ )a  Bin values into buckets and count their occurrences.

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

Arguments:
    bins: A monotonically increasing sequence of values.
    bin_count: If no bins provided, this will be used to determine the distance of the bins.
    include_breakpoint: Include a column that shows the intervals as categories.

Returns:
    A new DataFrame containing the counts of values that occur within each passed bin.
r   )NarwhalsUnstableWarningrP   zZ`Series.hist` is being called from the stable API although considered an unstable feature.messagecategory
stacklevel)binsr   r   )narwhals.exceptionsr   narwhals.utilsrQ   r   r   hist)r}   r  r   r   r   rQ   r   r   s          r~   r  Series.hist  sD    * 	@2# 	 	SGXYw|1  
 	
r   r   r   )r   rn   )
r   r   r   r   r   z
str | Noner   r   r   rn   r{   )r  zlist[float | int] | Noner   
int | Noner   r   r   rn   )r   r   r   r   r   r   r   r   r   r  r   r   r   s   @r~   r*   r*     s    6  " 
 
 	

 
 
 

 
: *.!
 !%#'!
&!
 	!

 !!
 
!
 !
r   r*   c                     ^  \ rS rSrSU 4S jjrSSS jjrSSS jjrSSS jjrSS.SS jjrS	S	S
.SS jjr	SS jr
 SSS	SS.         SS jjjrSrU =r$ )r   i  c                    > [         TU ]  5       $ r{   )r   _taxicab_normr   s    r~   r   Expr._l1_norm  s    w$&&r   c                   ^ ^ T R                  UU 4S jT R                  R                  [        R                  5      5      $ )zeGet the first `n` rows.

Arguments:
    n: Number of rows to return.

Returns:
    A new expression.
c                D   > TR                  U 5      R                  T5      $ r{   )r   headr   r   r}   s    r~   <lambda>Expr.head.<locals>.<lambda>      //499!<r   r   	_metadatawith_kind_and_closeable_windowr   
FILTRATIONr}   r   s   ``r~   r  	Expr.head  1     ~~<NN99(:M:MN
 	
r   c                   ^ ^ T R                  UU 4S jT R                  R                  [        R                  5      5      $ )zdGet the last `n` rows.

Arguments:
    n: Number of rows to return.

Returns:
    A new expression.
c                D   > TR                  U 5      R                  T5      $ r{   )r   r   r  s    r~   r  Expr.tail.<locals>.<lambda>  r  r   r  r  s   ``r~   r   	Expr.tail  r  r   c                   ^ ^^ T R                  UUU 4S jT R                  R                  [        R                  5      5      $ )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                B   > TR                  U 5      R                  TTS9$ )Nr   )r   r   )r   r   r   r}   s    r~   r  #Expr.gather_every.<locals>.<lambda>  s     //4AAAfAUr   r  r   s   ```r~   r   Expr.gather_every  s1     ~~UNN99(:M:MN
 	
r   N)maintain_orderc                  ^  Ub  Sn[        U[        [        5       S9  T R                  U 4S jT R                  R                  [        R                  5      5      $ )a  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.
zx`maintain_order` has no effect and is only kept around for backwards-compatibility. You can safely remove this argument.r   c                B   > TR                  U 5      R                  5       $ r{   )r   uniquer   r}   s    r~   r  Expr.unique.<locals>.<lambda>-  s    //4;;=r   )r   UserWarningrQ   r   r  	with_kindr   r  )r}   r!  r   s   `  r~   r$  Expr.unique  sR     %7  {?PQ~~=NN$$X%8%89
 	
r   F
descending
nulls_lastc               h   ^ ^^ T R                  UUU 4S jT R                  R                  5       5      $ )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                B   > TR                  U 5      R                  TTS9$ )Nr*  )r   r   )r   r+  r,  r}   s    r~   r  Expr.sort.<locals>.<lambda><  s%    //499%* : r   )r   r  with_uncloseable_window)r}   r+  r,  s   ```r~   r   	Expr.sort1  s-     ~~ NN224	
 	
r   c                ~   ^  T R                  U 4S jT R                  R                  [        R                  5      5      $ )zPFind elements where boolean expression is True.

Returns:
    A new expression.
c                B   > TR                  U 5      R                  5       $ r{   )r   arg_truer%  s    r~   r  Expr.arg_true.<locals>.<lambda>I  s    //4==?r   r  r|   s   `r~   r4  Expr.arg_trueB  s1     ~~?NN99(:M:MN
 	
r   fractionwith_replacementseedc                  ^ ^^^^ T R                  UUUU U4S jT R                  R                  [        R                  5      5      $ )a  Sample randomly from this expression.

!!! warning
    `Expr.sample` is deprecated and will be removed in a future version.
    Hint: instead of `df.select(nw.col('a').sample())`, use
    `df.select(nw.col('a')).sample()` instead.
    Note: this will remain available in `narwhals.stable.v1`.
    See [stable api](../backcompat.md/) for more information.

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                F   > TR                  U 5      R                  TTTTS9$ )Nr7  )r   sample)r   r8  r   r:  r}   r9  s    r~   r  Expr.sample.<locals>.<lambda>i  s*    //4;;H7Gd < r   )r   r  r(  r   r  )r}   r   r8  r9  r:  s   `````r~   r=  Expr.sampleM  s:    6 ~~  NN$$X%8%89	
 	
r   r   r   )
   r   r   r   )r!  bool | Noner   r]   )r+  r   r,  r   r   r]   r{   )
r   r  r8  zfloat | Noner9  r   r:  r  r   r]   )r   r   r   r   r   r  r   r   r$  r   r4  r=  r   r   r   s   @r~   r   r     s    '


 7; 
, */5 
"	
  
 "&!& 
 
 	 

  
  
 
 
  
r   r   c                  0    \ rS rSrSr\R                  rSrg)r(   ip  a&  Ordered mapping of column names to their data type.

Arguments:
    schema: Mapping[str, DType] | Iterable[tuple[str, DType]] | None
        The schema definition given by column names and their associated.
        *instantiated* Narwhals data type. Accepts a mapping or an iterable of tuples.
r   N)	r   r   r   r   r   rN   V1_versionr   r   r   r~   r(   r(   p  s     zzHr   r(   c                    g r{   r   objs    r~   
_stableifyrH  |      GJr   c                    g r{   r   rF  s    r~   rH  rH  ~  rI  r   c                    g r{   r   rF  s    r~   rH  rH        CFr   c                    g r{   r   rF  s    r~   rH  rH    s    %(r   c                    g r{   r   rF  s    r~   rH  rH    s    !$r   c                P   [        U [        5      (       a;  [        U R                  R	                  [
        R                  5      U R                  S9$ [        U [        5      (       a;  [        U R                  R	                  [
        R                  5      U R                  S9$ [        U [        5      (       a;  [        U R                  R	                  [
        R                  5      U R                  S9$ [        U [        5      (       a   [        U R                  U R                   5      $ U $ )N)level)r   NwDataFramer   r   _with_versionrN   rC  _levelNwLazyFramer   NwSeriesr*   _compliant_seriesNwExprr   r   r  rF  s    r~   rH  rH    s     #{##--;;GJJGszzZZ#{##--;;GJJGszzZZ#x  c++99'**ESZZXX#vC**CMM::Jr   c                    g r{   r   native_objectkwdss     r~   from_nativer\    s    ADr   c                    g r{   r   rY  s     r~   r\  r\    rI  r   c                    g r{   r   rY  s     r~   r\  r\    rI  r   c                    g r{   r   rY  s     r~   r\  r\    s     "r   .)
eager_onlyseries_onlyc                   g r{   r   rZ  strictr`  eager_or_interchange_onlyra  allow_seriess         r~   r\  r\         7:r   )re  ra  c                   g r{   r   rc  s         r~   r\  r\    rg  r   )r`  ra  rf  c                   g r{   r   rc  s         r~   r\  r\         !$r   c                   g r{   r   rc  s         r~   r\  r\         	r   )re  ra  rf  c                   g r{   r   rc  s         r~   r\  r\    rj  r   c                   g r{   r   rc  s         r~   r\  r\    rl  r   )r`  re  ra  c                   g r{   r   rc  s         r~   r\  r\    	     KNr   )r`  re  rf  c                   g r{   r   rc  s         r~   r\  r\          r   )r`  re  ra  rf  c                   g r{   r   rc  s         r~   r\  r\         58r   c                   g r{   r   rc  s         r~   r\  r\    rl  r   )rd  r`  ra  rf  c                   g r{   r   rc  s         r~   r\  r\  $  rj  r   )rd  re  ra  rf  c                   g r{   r   rc  s         r~   r\  r\  0  rj  r   )rd  r`  re  ra  c                   g r{   r   rc  s         r~   r\  r\  <  rt  r   )rd  r`  re  rf  c                   g r{   r   rc  s         r~   r\  r\  H  rr  r   )rd  r`  re  ra  rf  c                   g r{   r   rc  s         r~   r\  r\  T  rj  r   c                   g r{   r   rc  s         r~   r\  r\  a  rt  r   c                   g r{   r   rZ  pass_throughr`  re  ra  rf  s         r~   r\  r\  m  rj  r   c                   g r{   r   r}  s         r~   r\  r\  y  rg  r   c                   g r{   r   r}  s         r~   r\  r\    rj  r   c                   g r{   r   r}  s         r~   r\  r\    rl  r   c                   g r{   r   r}  s         r~   r\  r\    rj  r   c                   g r{   r   r}  s         r~   r\  r\    rl  r   c                   g r{   r   r}  s         r~   r\  r\    rp  r   c                   g r{   r   r}  s         r~   r\  r\    rr  r   c                   g r{   r   r}  s         r~   r\  r\    rt  r   c                   g r{   r   r}  s         r~   r\  r\    rl  r   )r~  r`  ra  rf  c                   g r{   r   r}  s         r~   r\  r\    rj  r   )r~  re  ra  rf  c                   g r{   r   r}  s         r~   r\  r\    rj  r   )r~  r`  re  ra  c                   g r{   r   r}  s         r~   r\  r\    rt  r   )r~  r`  re  rf  c                   g r{   r   r}  s         r~   r\  r\  	  rr  r   r~  r`  re  ra  rf  c                   g r{   r   r}  s         r~   r\  r\    rt  r   F)re  c                   g r{   r   r}  s         r~   r\  r\  "  s     r   )rd  r~  r`  re  ra  rf  c          
     N   [        U [        [        45      (       a	  U(       d  U $ [        U [        5      (       a  U(       d  U(       a  U $ [	        XSSS9nU(       a#  S[        [        U5      5      < 3n[        U5      e[        U UUUUU[        R                  S9n	[        U	5      $ )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`  re  ra  rf  version)r   r   r   r*   rZ   nextiterr   rH   rN   rC  rH  )
rZ  rd  r~  r`  re  ra  rf  r[  r   results
             r~   r\  r\  .  s    z -)Y!788-((k\25SXL A$tDzBRAUVn!";!

F fr   )rd  c                   g r{   r   narwhals_objectrd  s     r~   	to_nativer         r   c                   g r{   r   r  s     r~   r  r         r   c                   g r{   r   r  s     r~   r  r         r   c                   g r{   r   r  s     r~   r  r    s    =@r   r~  c                   g r{   r   r  r~  s     r~   r  r    r  r   c                   g r{   r   r  s     r~   r  r    r  r   c                   g r{   r   r  s     r~   r  r    r  r   c                   g r{   r   r  s     r~   r  r    rL  r   )rd  r~  c                  SSK Jn  SSKJn  SSKJn  U" XSSS9n[        X5      (       a  U R                  R                  $ [        X5      (       a  U R                  R                  $ U(       d  S[        U 5       S3n[        U5      eU $ )	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)   rY   Fr  zExpected Narwhals object, got .)r   r   r   r*   r  rZ   r   r   _native_framerV  nativer   r   )r  rd  r~  r   r*   rZ   r   s          r~   r  r    s    : -&>25SXL /--//===/**00777.tO/D.EQGnr   Tc               V   ^^^^^ [        UTSSS9mSUUUUU4S jjnU c  U$ U" U 5      $ )aj	  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: **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/).

        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
    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  c                @   >^  [        T 5      SUUUU UU4S jj5       nU$ )Nc                   > U  Vs/ s H  n[        UTTTTT
S9PM     n nUR                  5        VVs0 s H  u  p4U[        UTTTTT
S9_M     nnn/ U QUR                  5       Q7 Vs1 s H   n[        USS 5      =n(       d  M  U" 5       iM"     nnUR	                  5       S:  a  Sn[        U5      eT" U 0 UD6n	[        U	TS9$ s  snf s  snnf s  snf )Nr  __native_namespace__   z_Found multiple backends. Make sure that all dataframe/series inputs come from the same backend.r  )r\  itemsvaluesgetattr__len__
ValueErrorr  )argsr   r   r   valuevbbackendsr   r  rf  r`  re  funcr~  ra  s             r~   wrapper.narwhalify.<locals>.decorator.<locals>.wrapper  s%     
  C !-).G +!-    
* $*<<>
 $2KD k!-).G +!-  $2  
 342&--/22A $:DAAAA 2   !A%w o%4*6*FV,??I

s   CC	(CC)r  r   r   r   r   r   r   )r  r  rf  r`  re  r~  ra  s   ` r~   	decoratornarwhalify.<locals>.decorator  s)    	t%	@ %	@ 
%	@N r   )r  Callable[..., Any]r   r  rY   )r  rd  r~  r`  re  ra  rf  r  s     ````` r~   
narwhalifyr    s>    z 34RWL) )V | r   c                 >    [        [        R                  " 5       5      $ )zTInstantiate an expression representing all columns.

Returns:
    A new expression.
)rH  nwr   r   r   r~   r   r   D       bffhr   c                 :    [        [        R                  " U 6 5      $ )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.
)rH  r  r   namess    r~   r   r   M  s     bffen%%r   c                 :    [        [        R                  " U 6 5      $ )zCreates an expression that excludes columns by their name(s).

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

Returns:
    A new expression.
)rH  r  excluder  s    r~   r  r  Y  s     bjj%())r   c                 :    [        [        R                  " U 6 5      $ )a)  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.
)rH  r  nth)indicess    r~   r  r  e  s     bffg&''r   c                 >    [        [        R                  " 5       5      $ )z;Return the number of rows.

Returns:
    A new expression.
)rH  r  lenr   r   r~   r  r  u  r  r   c                @    [        [        R                  " X5      5      $ )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.
)rH  r  lit)r  dtypes     r~   r  r  ~  s     bffU*++r   c                 :    [        [        R                  " U 6 5      $ )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.
)rH  r  mincolumnss    r~   r  r         bffg&''r   c                 :    [        [        R                  " U 6 5      $ )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.
)rH  r  maxr  s    r~   r  r    r  r   c                 :    [        [        R                  " U 6 5      $ )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.
)rH  r  meanr  s    r~   r  r    s     bggw'((r   c                 :    [        [        R                  " U 6 5      $ )aP  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.
)rH  r  medianr  s    r~   r  r    s     bii)**r   c                 :    [        [        R                  " U 6 5      $ )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.
)rH  r  sumr  s    r~   r  r    r  r   c                 :    [        [        R                  " U 6 5      $ )a  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.
)rH  r  sum_horizontalexprss    r~   r  r         b''/00r   c                 :    [        [        R                  " U 6 5      $ )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.
)rH  r  all_horizontalr  s    r~   r  r         b''/00r   c                 :    [        [        R                  " U 6 5      $ )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.
)rH  r  any_horizontalr  s    r~   r  r    r  r   c                 :    [        [        R                  " U 6 5      $ )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.
)rH  r  mean_horizontalr  s    r~   r  r    s     b((%011r   c                 :    [        [        R                  " U 6 5      $ )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.
)rH  r  min_horizontalr  s    r~   r  r    r  r   c                 :    [        [        R                  " U 6 5      $ )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.
)rH  r  max_horizontalr  s    r~   r  r     r  r   verticalhowc          
     P    [        S[        [        R                  " XS95      5      $ )a  Concatenate multiple DataFrames, LazyFrames into a single entity.

Arguments:
    items: DataFrames, LazyFrames to concatenate.
    how: concatenating strategy:

        - vertical: Concatenate vertically. Column names must match.
        - horizontal: Concatenate horizontally. If lengths don't match, then
            missing rows are filled with null values. This is only supported
            when all inputs are (eager) DataFrames.
        - diagonal: Finds a union between the column schemas and fills missing column
            values with null.

Returns:
    A new DataFrame or LazyFrame resulting from the concatenation.

Raises:
    TypeError: The items to concatenate should either all be eager, or all lazy
rm   r  )r   rH  r  concat)r  r  s     r~   r  r  0  s    ( *RYYu%>?@@r    	separatorignore_nullsc               H    [        [        R                  " U /UQ7XS.65      $ )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  )rH  r  
concat_str)r  r  r  
more_exprss       r~   r  r  G  s'    , 
eYjYIY r   c                  @   ^  \ rS rSr\SS j5       rSU 4S jjrSrU =r$ )r   ib  c                &    U " UR                   5      $ r{   )
_predicate)clsr'   s     r~   	from_whenWhen.from_whenc  s    4??##r   c                H   > [         R                  [        TU ]  U5      5      $ r{   )r   	from_thenr   thenr}   r  r   s     r~   r  	When.theng  s    ~~egl5122r   r   )r'   NwWhenr   r   )r  &IntoExpr | NonNestedLiteral | _1DArrayr   r   )	r   r   r   r   classmethodr  r  r   r   r   s   @r~   r   r   b  s    $ $3 3r   r   c                  @   ^  \ rS rSr\SS j5       rSU 4S jjrSrU =r$ )r   ik  c                <    U " UR                   UR                  5      $ r{   )r   r  )r  r  s     r~   r  Then.from_thenl  s    4**DNN;;r   c                4   > [        [        TU ]	  U5      5      $ r{   )rH  r   	otherwiser  s     r~   r  Then.otherwisep  s    %'+E233r   r   )r  NwThenr   r   )r  r  r   r   )	r   r   r   r   r  r  r  r   r   r   s   @r~   r   r   k  s    < <4 4r   r   c                 8    [         R                  [        U 6 5      $ )aG  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_when)
predicatess    r~   r'   r'   t  s    , >>':.//r   )required)r   native_namespacec          
     ^    [        SU5      n[        [        XX#[        R                  S95      $ )a  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 | strr   r  )r   rH  r    rN   rC  )r   r  r  r   r  s        r~   
new_seriesr    s/    D 6@GuwzzR r   c               \    [        SU5      n[        [        X[        R                  S95      $ )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   rH  r   rN   rC  )native_framer   r  s      r~   
from_arrowr    s,    : 6@G

K r   c          	     F    [        [        XU[        R                  S95      $ )a.  Instantiate DataFrame from dictionary.

Indexes (if present, for pandas-like backends) are aligned following
the [left-hand-rule](../pandas_like_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  )rH  r   rN   rC  dataschemar   r  s       r~   	from_dictr    s"    P gwzzJ r   c          	     ^    [        SU5      n[        [        XU[        R                  S95      $ )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   rH  r   rN   rC  r  s       r~   
from_numpyr!    s+    J 6@G&tWgjjYZZr   c               H    [        SU5      n[        [        U 4SU0UD65      $ )a  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   rH  r!   sourcer   r  r   s       r~   read_csvr%  .  s1    @ 6@Gv9w9&9 r   c               H    [        SU5      n[        [        U 4SU0UD65      $ )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   rH  r#   r#  s       r~   scan_csvr'  T  s1    F 6@Gv9w9&9 r   c               H    [        SU5      n[        [        U 4SU0UD65      $ )a  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   rH  r"   r#  s       r~   read_parquetr)  }  s1    @ 6@G6=7=f= r   c               H    [        SU5      n[        [        U 4SU0UD65      $ )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   rH  r$   r#  s       r~   scan_parquetr+    s1    b 6@G6=7=f= r   )Pr,   r-   r.   r/   r   r0   r1   r2   r3   r4   r   r5   r6   r7   rM   r8   r9   r:   r;   r<   r   r=   r>   r(   r*   r?   r@   rA   rB   rC   rD   rE   rF   rG   r   r  r  r   r  r  r   r+   r   r  r  r  r\  r!  rR   r%   rI   rS   r  r  r  r  rT   rU   rV   rW   rX   r  r  r  r  r  r  r  r  r%  r)  r'  r+  r   r&   r  r  r  rJ   r'   )rG  zNwDataFrame[IntoFrameT]r   zDataFrame[IntoFrameT])rG  zNwLazyFrame[IntoFrameT]r   LazyFrame[IntoFrameT])rG  zNwSeries[IntoSeriesT]r   Series[IntoSeriesT])rG  rW  r   r   )rG  r   r   r   )rG  zXNwDataFrame[IntoFrameT] | NwLazyFrame[IntoFrameT] | NwSeries[IntoSeriesT] | NwExpr | Anyr   zPDataFrame[IntoFrameT] | LazyFrame[IntoFrameT] | Series[IntoSeriesT] | Expr | Any)rZ  rs   r[  r   r   rs   )rZ  rp   r[  r   r   rp   )rZ  rr   r[  r   r   rr   )rZ  DataFrameT | LazyFrameTr[  r   r   r.  )rZ  IntoDataFrameT | IntoSeriesTrd  r   r`  r   re  r   ra  r   rf  r   r   /DataFrame[IntoDataFrameT] | Series[IntoSeriesT])rZ  r/  rd  r   r`  r   re  r   ra  r   rf  r   r   r0  )rZ  rK   rd  r   r`  r   re  r   ra  r   rf  Noner   DataFrame[IntoDataFrameT])rZ  rw   rd  r   r`  r   re  r   ra  r   rf  r1  r   rw   )rZ  rK   rd  r   r`  r   re  r   ra  r   rf  r1  r   r2  )rZ  rw   rd  r   r`  r   re  r   ra  r   rf  r1  r   rw   )rZ  IntoFrameT | IntoSeriesTrd  r   r`  r   re  r   ra  r   rf  r   r   CDataFrame[IntoFrameT] | LazyFrame[IntoFrameT] | Series[IntoSeriesT])rZ  ru   rd  r   r`  r   re  r   ra  r   rf  r1  r   r-  )rZ  rL   rd  r   r`  r   re  r   ra  r   rf  r1  r   -DataFrame[IntoFrameT] | LazyFrame[IntoFrameT])rZ  rw   rd  r   r`  r   re  r   ra  r   rf  r1  r   rw   )rZ  rK   rd  r   r`  r   re  r   ra  r   rf  r1  r   r2  )rZ  rK   rd  r   r`  r   re  r   ra  r   rf  r1  r   r2  )rZ  IntoFrame | IntoSeriesrd  r   r`  r   re  r   ra  r   rf  r   r   -DataFrame[Any] | LazyFrame[Any] | Series[Any])rZ  ru   rd  r   r`  r   re  r   ra  r   rf  r1  r   r-  )rZ  rf   rd  r   r`  r   re  r   ra  r   rf  r1  r   zLazyFrame[IntoLazyFrameT])rZ  rL   rd  r   r`  r   re  r   ra  r   rf  r1  r   r5  )rZ  zIntoDataFrameT | IntoSeriesr~  r   r`  r   re  r   ra  r   rf  r   r   r2  )rZ  r/  r~  r   r`  r   re  r   ra  r   rf  r   r   r0  )rZ  rK   r~  r   r`  r   re  r   ra  r   rf  r1  r   r2  )rZ  rw   r~  r   r`  r   re  r   ra  r   rf  r1  r   rw   )rZ  rK   r~  r   r`  r   re  r   ra  r   rf  r1  r   r2  )rZ  rw   r~  r   r`  r   re  r   ra  r   rf  r1  r   rw   )rZ  r3  r~  r   r`  r   re  r   ra  r   rf  r   r   r4  )rZ  ru   r~  r   r`  r   re  r   ra  r   rf  r1  r   r-  )rZ  rL   r~  r   r`  r   re  r   ra  r   rf  r1  r   r5  )rZ  rw   r~  r   r`  r   re  r   ra  r   rf  r1  r   rw   )rZ  rK   r~  r   r`  r   re  r   ra  r   rf  r1  r   r2  )rZ  rK   r~  r   r`  r   re  r   ra  r   rf  r1  r   r2  )rZ  r6  r~  r   r`  r   re  r   ra  r   rf  r   r   r7  )rZ  ru   r~  r   r`  r   re  r   ra  r   rf  r1  r   r-  )rZ  rL   r~  r   r`  r   re  r   ra  r   rf  r1  r   r5  )rZ  r   r~  r   r`  r   re  r   ra  r   rf  rA  r   r   )rZ  z5IntoFrameT | IntoFrame | IntoSeriesT | IntoSeries | Trd  rA  r~  rA  r`  r   re  r   ra  r   rf  rA  r[  r   r   zGLazyFrame[IntoFrameT] | DataFrame[IntoFrameT] | Series[IntoSeriesT] | T)r  r2  rd  r   r   rK   )r  r,  rd  r   r   rL   )r  r-  rd  r   r   ru   )r  r   rd  r   r   r   )r  r2  r~  r   r   rK   )r  r,  r~  r   r   rL   )r  r-  r~  r   r   ru   )r  r   r~  r   r   r   )r  zGDataFrame[IntoDataFrameT] | LazyFrame[IntoFrameT] | Series[IntoSeriesT]rd  rA  r~  rA  r   zIntoFrameT | IntoSeriesT | Anyr{   )r  zCallable[..., Any] | Nonerd  rA  r~  rA  r`  r   re  r   ra  r   rf  rA  r   r  )r   r   )r  zstr | Iterable[str]r   r   )r  zint | Sequence[int]r   r   )r  rh   r  DType | type[DType] | Noner   r   )r  r   r   r   )r  IntoExpr | Iterable[IntoExpr]r   r   )r  zIterable[FrameT]r  rc   r   rm   )
r  r9  r  rd   r  r   r  r   r   r   )r  r9  r   r   )r   r   r  r   r  r8  r   r   r  ModuleType | Noner   rt   )r  r_   r   r   r  r:  r   rn   )
r  zMapping[str, Any]r  z#Mapping[str, DType] | Schema | Noner   r   r  r:  r   rn   )
r  rl   r  z3Mapping[str, DType] | Schema | Sequence[str] | Noner   r   r  r:  r   rn   )
r$  r   r   r   r  r:  r   r   r   rn   )
r$  r   r   r   r  r:  r   r   r   ro   )
__future__r   	functoolsr   typingr   r   r   r	   r
   r   r   r   warningsr   narwhalsr  r   r   r   narwhals._expression_parsingr   r   r   rQ  r   rT  narwhals.dependenciesr   r  r   r   r   rW  narwhals.functionsr   r  r   r  r   r   r   r    r!   r"   r#   r$   r%   r&   r'   r  narwhals.schemar(   NwSchemar   r*   rU  narwhals.stable.v1r+   narwhals.stable.v1.dtypesr,   r-   r.   r/   r0   r1   r2   r3   r4   r5   r6   r7   r8   r9   r:   r;   r<   r=   r>   r?   r@   rA   rB   rC   rD   rE   rF   rG   narwhals.translaterH   rI   rJ   narwhals.typingrK   rL   r  rM   rN   rO   rQ   rR   rS   rT   rU   rV   rW   rX   rZ   typesr[   r\   typing_extensionsr]   r^   narwhals._translater_   r`   ra   narwhals.dtypesrb   rc   rd   re   rf   rg   rh   ri   rj   rk   rl   rm   rp   rr   rs   ru   rw   rH  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+  __all__r   r   r~   <module>rN     s.   "             !   1 7 7 , 4 ( - - / . / / - 1 - 1 ( , . . . % + , - 1 * . - . * + - - * + + + , * , , , * + , , , - - 0 3 + * & ) " 5 * 9 1 , / * , * : &)235%,().*013((X/1ABF-=>J-=>Ji}5G-|SIKS!A-|<KAT-N+ T-nr
J' r
jd
Xk" d
NA
6 A
H	X 	 
 J 
 J	 J 
 J	 F 
 F	 ( 
 (	 $ 
 $

 V$ 
 D 
 D 
 J 
 J 
 J 
 J 
"*"47"" 
"
 

 "%"%:/: : 	:
  -:  :  : 5: 
: 
 14"%:/: : 	:
  .:  :  : 5: 
: 

 "%"%$!$ $ 	$
  -$  $ $ $ 
$ 

 "%"%  	
  -     
 
 14"%$!$ $ 	$
  .$  $ $ $ 
$ 
 14"%  	
  .     
 

 "%03"%N+N N 	N
  .N  N  N IN 
N 

 "%03  	
  .    
 

 "%03"%88 8 	8
  .8  8 8 38 
8 

 "%03"%  	
  .     
 
  !$"%$!$ $ 	$
  -$  $ $ $ 
$ 
  03"%$!$ $ 	$
  .$  $ $ $ 
$ 
  !$03"%8)8 8 	8
  .8  8  8 38 
8 
  !$03  	
  .    
 
  !$03"%$!$ $ 	$
  .$  $ $ $ 
$ 
  !$03"%88 8 	8
  .8  8 8 38 
8 

 "%"%$.$  $ 	$
  -$  $  $ $ 
$ 
 14"%:/:  : 	:
  .:  :  : 5: 
: 

 "%"%$!$  $ 	$
  -$  $ $ $ 
$ 

 "%"%   	
  -     
 
 14"%$!$  $ 	$
  .$  $ $ $ 
$ 
 14"%   	
  .     
 

 "%03"%N+N  N 	N
  .N  N  N IN 
N 

 "%03   	
  .    
 

 "%03"%88  8 	8
  .8  8 8 38 
8 

 "%03"%   	
  .     
 
 $'!$"%$!$ !$ 	$
  -$  $ $ $ 
$ 
 $'03"%$!$ !$ 	$
  .$  $ $ $ 
$ 
 $'!$03"%8)8 !8 	8
  .8  8  8 38 
8 
 $'!$03 ! 	
  .    
 
 $'!$03"%88 !8 	8
  .8  8 8 38 
8 
 ',  	
  $   	 
  $&+ $RHR R 	R
 R  $R R R R MRj 
KN.;H 
 
GJ*7D 
 
EH(5B 
 
 @ 
 @	RU.AO 
 
NQ*=K 
 
LO(;I 
 
 F 
 F  $--
 - - $-b '+p  $&+ $p
#p p 	p
 p  $p p p pf 	&	*(  , ,(()+"(1 
1
1
21 1  <F A A4 	(  	
 
636 3464 402 T* )-$
 9=*.$
$$ &$
 6$ ($ $ +$N T* 9=*.	  6 (	
  +D  37) 9=*.)
)/) 6	)
 () ) )X T* CG%[ 9=*.%[
%[?%[ 6	%[
 (%[ %[ +%[P T* 9=*.	"" 6" (	"
 " " +"J T* 9=*.	%% 6% (	%
 % % +%P T* 9=*.	"" 6" (	"
 " " +"J T* 9=*.	33 63 (	3
 3 3 +3lQr   