
    h
                   P   % S SK Jr  S SK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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)J1r1  S S(K)J2r2  S S)K)J3r3  S S*K)J4r4  \(       a  S S+K5J6r6  S S,K7J8r8  S S-K7J9r9  S S.K:J;r;  S S/K:J<r<  S S0K=J>r>  S S1K?J@r@  S S2K?JArA  S S3KBJCrC  S S4KDJErE  S SK$J%r%  S S5KFJGrG  S S6KFJHrH  S S7KFJIrI  S S8KFJJrJ  S S9KFJKrK  S S:KFJLrL  S S;KFJMrM  S S<KFJNrN  S S=KFJOrO  S>rPS?\QS@'   \" SASBSC5      rRSDSE.S~SF jjrS\," SGSHSI9 SSSSJ.           SSK jjj5       rT S           SSL jjrU\," SMSN9 SSSSJ.         SSO jjj5       rV          SSP jrW    SSQ jrX\," SGSHSI9 SSSSJ.         SSR jjj5       rY S         SSS jjrZSST jr[\," SGSHSI9SSSJ.       SSU jj5       r\        SSV jr]SSW jr^SSX jr_SSY jr`    SSZ jra\," S[SHSI9SSSJ.         SS\ jj5       rb        SS] jrc\," SGSHSI9SSSJ.         SS^ jj5       rd        SS_ jre\," SGSHSI9SSSJ.         SS` jj5       rf        SSa jrg\," SGSHSI9SSSJ.         SSb jj5       rh        SSc jriSSd jrjSSe jrkSSf jrlSSg jrmSSh jrnSSi jroSSj jrpSSk jrqSSl jrrSSm jrsSSn jrtSSo jruSSp jrv " Sq Sr5      rw " Ss St\#5      rxSSu jrySSv jrzSSSw jjr{SSx jr|SSy jr}SzS{S|.         SS} jjr~g)    )annotationsNversion)TYPE_CHECKING)Any)Iterable)Literal)Mapping)Sequence)TypeVar)cast)ExpansionKind)ExprKind)ExprMetadata)
WindowKindapply_n_ary_operation)!check_expressions_preserve_length)combine_metadata)combine_metadata_horizontal_op)extract_compliant)
infer_kind)is_scalar_like)is_narwhals_series)is_numpy_array)is_numpy_array_2d)is_pyarrow_table)InvalidOperationError)Expr)Series)from_native)	to_native)Implementation)Version)deprecate_native_namespace)flatten)import_namespace)is_compliant_expr)is_eager_allowed)is_sequence_but_not_str)parse_version)supports_arrow_c_stream)validate_laziness)
ModuleType)	TypeAlias)TypeIs)CompliantExpr)CompliantNamespace)IntoArrowTable)	DataFrame)	LazyFrame)DTypeSchema)ConcatMethod)IntoExpr)IntoSeriesT)NativeFrame)NativeLazyFrame)NativeSeries)NonNestedLiteral)_1DArray)_2DArray3Mapping[str, DType] | Schema | Sequence[str] | Noner/   _IntoSchemaFrameTDataFrame[Any]LazyFrame[Any]verticalhowc               n   SSK Jn  U (       d  Sn[        U5      e[        U 5      n [	        U 5        US;  a  Sn[        U5      eU S   nU" U5      (       a  US:X  a  Sn[        U5      eUR                  5       nUR                  UR                  U  Vs/ s H  ofR                  PM     snUS95      $ s  snf )	uM  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

Examples:
    Let's take an example of vertical concatenation:

    >>> import pandas as pd
    >>> import polars as pl
    >>> import pyarrow as pa
    >>> import narwhals as nw

    Let's look at one case a for vertical concatenation (pandas backed):

    >>> df_pd_1 = nw.from_native(pd.DataFrame({"a": [1, 2, 3], "b": [4, 5, 6]}))
    >>> df_pd_2 = nw.from_native(pd.DataFrame({"a": [5, 2], "b": [1, 4]}))
    >>> nw.concat([df_pd_1, df_pd_2], how="vertical")
    ┌──────────────────┐
    |Narwhals DataFrame|
    |------------------|
    |        a  b      |
    |     0  1  4      |
    |     1  2  5      |
    |     2  3  6      |
    |     0  5  1      |
    |     1  2  4      |
    └──────────────────┘

    Let's look at one case a for horizontal concatenation (polars backed):

    >>> df_pl_1 = nw.from_native(pl.DataFrame({"a": [1, 2, 3], "b": [4, 5, 6]}))
    >>> df_pl_2 = nw.from_native(pl.DataFrame({"c": [5, 2], "d": [1, 4]}))
    >>> nw.concat([df_pl_1, df_pl_2], how="horizontal")
    ┌───────────────────────────┐
    |    Narwhals DataFrame     |
    |---------------------------|
    |shape: (3, 4)              |
    |┌─────┬─────┬──────┬──────┐|
    |│ a   ┆ b   ┆ c    ┆ d    │|
    |│ --- ┆ --- ┆ ---  ┆ ---  │|
    |│ i64 ┆ i64 ┆ i64  ┆ i64  │|
    |╞═════╪═════╪══════╪══════╡|
    |│ 1   ┆ 4   ┆ 5    ┆ 1    │|
    |│ 2   ┆ 5   ┆ 2    ┆ 4    │|
    |│ 3   ┆ 6   ┆ null ┆ null │|
    |└─────┴─────┴──────┴──────┘|
    └───────────────────────────┘

    Let's look at one case a for diagonal concatenation (pyarrow backed):

    >>> df_pa_1 = nw.from_native(pa.table({"a": [1, 2], "b": [3.5, 4.5]}))
    >>> df_pa_2 = nw.from_native(pa.table({"a": [3, 4], "z": ["x", "y"]}))
    >>> nw.concat([df_pa_1, df_pa_2], how="diagonal")
    ┌──────────────────────────┐
    |    Narwhals DataFrame    |
    |--------------------------|
    |pyarrow.Table             |
    |a: int64                  |
    |b: double                 |
    |z: string                 |
    |----                      |
    |a: [[1,2],[3,4]]          |
    |b: [[3.5,4.5],[null,null]]|
    |z: [[null,null],["x","y"]]|
    └──────────────────────────┘
r   )is_narwhals_lazyframezNo items to concatenate.>   diagonalrG   
horizontalzDOnly vertical, horizontal and diagonal concatenations are supported.rM   zdHorizontal concatenation is not supported for LazyFrames.

Hint: you may want to use `join` instead.rH   )narwhals.dependenciesrK   
ValueErrorlistr-   NotImplementedErrorr   __narwhals_namespace___with_compliantconcat_compliant_frame)itemsrI   rK   msg
first_itemplxdfs          D/var/www/html/env/lib/python3.13/site-packages/narwhals/functions.pyrT   rT   K   s    d <(oKEe
88T!#&&qJZ((SL-@8 	 $C((

+
+
-C%%

%8%B''%8c
B 8s   B2z1.31.0T)warn_versionrequired)backendnative_namespacec               L    [        SU5      n[        XX#[        R                  S9$ )u!  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

Examples:
    >>> import pandas as pd
    >>> import narwhals as nw
    >>>
    >>> values = [4, 1, 2, 3]
    >>> nw.new_series(name="a", values=values, dtype=nw.Int32, backend=pd)
    ┌─────────────────────┐
    |   Narwhals Series   |
    |---------------------|
    |0    4               |
    |1    1               |
    |2    2               |
    |3    3               |
    |Name: a, dtype: int32|
    └─────────────────────┘
!ModuleType | Implementation | strr^   r   )r   _new_series_implr$   MAIN)namevaluesdtyper^   r_   s        r[   
new_seriesrh      s%    d 6@GD%',,WW    c                  [         R                  " U5      n[        U5      (       aH  [        U5      R                  U5      R                  nUR
                  R                  XXbS9n[        USS9$ U[         R                  L a  Sn[        U5      eUR                  5       n	 U	R                  XU5      n
[        U
SS9R                  U 5      $ ! [         a  nSn[        U5      UeS nAff = f)N)re   contextrg   T)series_onlyzGDask support in Narwhals is lazy-only, so `new_series` is not supportedzDUnknown namespace is expected to implement `new_series` constructor.)r#   from_backendr)   r'   	compliant_seriesfrom_iterabler!   DASKrQ   to_native_namespacerh   aliasAttributeError)re   rf   rg   r^   r   implementationnsseriesrW   r_   native_serieses               r[   rc   rc      s     $009N''g&33NCMM))&R)U6t44	>..	.W!#&&)==?	-*:*E*EdTY*ZM}$?EEdKK 	-XC %1,	-s    *C 
C(C##C(z1.26.0)r\   c               4    [        XU[        R                  S9$ )u  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.

Examples:
    >>> import pandas as pd
    >>> import narwhals as nw
    >>> data = {"c": [5, 2], "d": [1, 4]}
    >>> nw.from_dict(data, backend="pandas")
    ┌──────────────────┐
    |Narwhals DataFrame|
    |------------------|
    |        c  d      |
    |     0  5  1      |
    |     1  2  4      |
    └──────────────────┘
rb   )_from_dict_implr$   rd   dataschemar^   r_   s       r[   	from_dictr     s    j 4',,OOri   c                  U (       d  Sn[        U5      eUc  [        U 5      u  p[        R                  " U5      n[	        U5      (       aH  [        U5      R                  U5      R                  nUR                  R                  XUS9n[        USS9$ U[        R                  L a*  UR                  5       n UR                  XS9n	[        U	SS9$ S[        R                  [        R                  [        R                  [        R                   [        R"                  4 SU S	3n[        U5      e! [         a  n
Sn[        U5      U
eS n
A
ff = f)
Nz0from_dict cannot be called with empty dictionary)r~   rk   T
eager_onlyr~   z@Unknown namespace is expected to implement `from_dict` function.z-Unsupported `backend` value.
Expected one of z or None, got: .)rO   _from_dict_no_backendr#   rm   r)   r'   rn   
_dataframer   r!   UNKNOWNrr   rt   POLARSPANDASPYARROWMODINCUDFr}   r~   r^   r   rW   ru   rv   framer_   native_framery   s              r[   r{   r{   <  sE    @o-d3#009N''g&33NCMM''R'H5T22	>11	1)==?	- )9(B(B4(B(WL <D99
8  ."7"79O9OQ_QeQegugzgzz
{ |'(	+ 
 S/  	-TC %1,	-s   7D/ /
E9EEc          
         U R                  5        H%  n[        U5      (       d  M  UR                  5       n  O   Sn[        U5      eU R	                  5        VVs0 s H  u  pEU[        USS9_M     n nnX4$ s  snnf )NzgCalling `from_dict` without `backend` is only supported if all input values are already Narwhals SeriesT)pass_through)rf   r   __native_namespace__	TypeErrorrV   r"   )r}   valr_   rW   keyvalues         r[   r   r   _  sz     {{}c"""779 
 xnGKzz|T|C5t44|DT!! Us   A7c               L    [        SU5      n[        XU[        R                  S9$ )u  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.

Examples:
    >>> import numpy as np
    >>> import pyarrow as pa
    >>> import narwhals as nw
    >>>
    >>> arr = np.array([[5, 2, 1], [1, 4, 3]])
    >>> schema = {"c": nw.Int16(), "d": nw.Float32(), "e": nw.Int8()}
    >>> nw.from_numpy(arr, schema=schema, backend="pyarrow")
    ┌──────────────────┐
    |Narwhals DataFrame|
    |------------------|
    |  pyarrow.Table   |
    |  c: int16        |
    |  d: float        |
    |  e: int8         |
    |  ----            |
    |  c: [[5,1]]      |
    |  d: [[2,4]]      |
    |  e: [[1,3]]      |
    └──────────────────┘
ra   rb   )r   _from_numpy_implr$   rd   r|   s       r[   
from_numpyr   m  s%    t 6@GD'7<<PPri   c                  [        U 5      (       d  Sn[        U5      e[        U5      (       d  S[        U5       S3n[	        U5      e[
        R                  " U5      n[        U5      (       a?  [        U5      R                  U5      R                  nUR                  X5      n[        USS9$ UR                  5       n UR                  XS9n	[        U	SS9$ ! [         a  n
Sn[        U5      U
eS n
A
ff = f)Nz)`from_numpy` only accepts 2D numpy arrayszi`schema` is expected to be one of the following types: Mapping[str, DType] | Schema | Sequence[str]. Got r   Tr   r   zAUnknown namespace is expected to implement `from_numpy` function.)r   rO   _is_into_schematyper   r#   rm   r)   r'   rn   r   r!   rr   rt   r   s              r[   r   r     s     T""9o6""<.# 	
 n#009N''g&33NCMMd+5T22)==?	- )9(C(CD(C(XL <D99  	-UC %1,	-s   >C 
C4!C//C4c                l    SSK Jn  U S L =(       d$    [        U [        U45      =(       d    [	        U 5      $ )Nr   r7   )narwhals.schemar8   
isinstancer
   r*   )objr8   s     r[   r   r     s0    & 	tYz#'89Y=TUX=Yri   c               J    [        SU5      n[        X[        R                  S9$ )u  Construct a DataFrame from an object which supports the PyCapsule Interface.

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

        `backend` can be specified in various ways:

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

Examples:
    >>> import pandas as pd
    >>> import polars as pl
    >>> import narwhals as nw
    >>>
    >>> df_native = pd.DataFrame({"a": [1, 2], "b": [4.2, 5.1]})
    >>> nw.from_arrow(df_native, backend="polars")
    ┌──────────────────┐
    |Narwhals DataFrame|
    |------------------|
    |  shape: (2, 2)   |
    |  ┌─────┬─────┐   |
    |  │ a   ┆ b   │   |
    |  │ --- ┆ --- │   |
    |  │ i64 ┆ f64 │   |
    |  ╞═════╪═════╡   |
    |  │ 1   ┆ 4.2 │   |
    |  │ 2   ┆ 5.1 │   |
    |  └─────┴─────┘   |
    └──────────────────┘
ra   rb   )r   _from_arrow_implr$   rd   )r   r^   r_   s      r[   
from_arrowr     s#    d 6@GL7<<PPri   c                  [        U 5      (       d*  [        U 5      (       d  S[        U 5       S3n[        U5      e[        R
                  " U5      n[        U5      (       aG  [        U5      R                  U5      R                  nUR                  R                  XS9n[        USS9$ UR                  5       n UR                  U 5      n[        USS9$ ! [         a  n	Sn[        U5      U	eS n	A	ff = f)NzGiven object of type z% does not support PyCapsule interface)rk   Tr   zuUnknown namespace is expected to implement `DataFrame` class which accepts object which supports PyCapsule Interface.)r,   r   r   r   r#   rm   r)   r'   rn   r   r   r!   rr   r4   rt   )
r}   r^   r   rW   ru   rv   r   r_   r   ry   s
             r[   r   r     s     $D))-=d-C-C%d4j\1VWn#009N''g&33NCMM(((:5T22)==?	- )9(B(B4(HL <D99  	- JC %1,	-s   9C 
C1C,,C1c                     [         R                  R                  SS5      n SU 4S[         R                  4S[        R                  " 5       44n[        U5      $ )zSystem information.

Returns system and Python version information

Copied from sklearn

Returns:
    Dictionary with system info.

 python
executablemachine)sysr   replacer   platformdict)r   blobs     r[   _get_sys_infor   %  sT     [[  s+F 
6	s~~&	H%%'(D :ri   c                     SSK Jn   SSK Jn  SSKJn  SnSU0nU H  n U" U5      XE'   M     U$ ! U  a    SXE'    M!  f = f)al  Overview of the installed version of main dependencies.

This function does not import the modules to collect the version numbers
but instead relies on standard Python package metadata.

Returns version information on relevant Python libraries

This function and show_versions were copied from sklearn and adapted

Returns:
    Mapping from dependency to version.
r   )PackageNotFoundErrorr   )__version__)pandaspolarscudfmodinpyarrownumpynarwhals )importlib.metadatar   r   r   r   )r   r   r   deps	deps_infomodnames         r[   _get_deps_infor   :  sY     8*$DD[)I	$!(!1I 
  $ 	$!#I	$s   
/
==c                     [        5       n [        5       n[        S5        U R                  5        H  u  p#[        US SU 35        M     [        S5        UR                  5        H  u  p#[        US SU 35        M     g)zPrint useful debugging information.

Examples:
    >>> from narwhals import show_versions
    >>> show_versions()  # doctest: +SKIP
z
System:z>10z: z
Python dependencies:z>13N)r   r   printrV   )sys_infor   kstats       r[   show_versionsr   W  sv     H I	+>>#3r$ ! $ 

"#??$3r$ ! %ri   c                    U R                   $ )a~  Level of support Narwhals has for current object.

Arguments:
    obj: Dataframe or Series.

Returns:
    This can be one of:

        - 'full': full Narwhals API support
        - 'lazy': only lazy operations are supported. This excludes anything
          which involves iterating over rows in Python.
        - 'interchange': only metadata operations are supported (`df.schema`)
)_level)r   s    r[   	get_levelr   j  s      ::ri   z1.27.2c               6    [        SU5      n[        U 4SU0UD6$ )ux  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.

Examples:
    >>> import narwhals as nw
    >>> nw.read_csv("file.csv", backend="pandas")  # doctest:+SKIP
    ┌──────────────────┐
    |Narwhals DataFrame|
    |------------------|
    |        a   b     |
    |     0  1   4     |
    |     1  2   5     |
    └──────────────────┘
ra   r^   )r   _read_csv_implsourcer^   r_   kwargss       r[   read_csvr   }  s'    V 6@G&<'<V<<ri   c                  [         R                  " U5      nUR                  5       nU[         R                  [         R                  [         R
                  [         R                  1;   a  UR                  " U 40 UD6nOBU[         R                  L a  SSK	J
n  UR                  " U 40 UD6nO UR                  " SSU 0UD6n[        USS9$ ! [         a  nSn[        U5      UeS nAff = f)Nr   csvr   z?Unknown namespace is expected to implement `read_csv` function.Tr    )r#   rm   rr   r   r   r   r   r   r   r   r   rt   r!   )	r   r^   r   eager_backendr_   r   r   ry   rW   s	            r[   r   r     s     #//8M$88:	  (00B6B	.00	0||F5f5	- ,44MFMfML |55  	-SC %1,	-s   +C	 	
C&C!!C&c               6    [        SU5      n[        U 4SU0UD6$ )u  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.

Examples:
    >>> import duckdb
    >>> import narwhals as nw
    >>>
    >>> nw.scan_csv("file.csv", backend="duckdb").to_native()  # doctest:+SKIP
    ┌─────────┬───────┐
    │    a    │   b   │
    │ varchar │ int32 │
    ├─────────┼───────┤
    │ x       │     1 │
    │ y       │     2 │
    │ z       │     3 │
    └─────────┴───────┘
ra   r^   )r   _scan_csv_implr   s       r[   scan_csvr     s'    b 6@G&<'<V<<ri   c                  [         R                  " U5      nUR                  5       nU[         R                  L a  UR                  " U 40 UD6nGOWU[         R
                  [         R                  [         R                  [         R                  [         R                  1;   a  UR                  " U 40 UD6nOU[         R                  L a  SSKJn  UR                  " U 40 UD6nOUR                  5       (       a  UR                  SS 5      =nc  Sn[!        U5      eUR"                  R%                  S5      n	U[         R&                  L a)  [)        [+        S5      5      S:  a  U	R-                  U 5      O U	R.                  " S
0 UD6R-                  U 5      nO UR                  " S
SU 0UD6n[3        U5      R5                  5       $ ! [0         a  n
S	n[1        U5      U
eS n
A
ff = f)Nr   r   sessionFSpark like backends require a session object to be passed in `kwargs`.r   sqlframe      r   r   z?Unknown namespace is expected to implement `scan_csv` function.r   )r#   rm   rr   r   r   r   r   r   rq   DUCKDBr   r   r   r   is_spark_likepoprO   readformatSQLFRAMEr+   r   loadoptionsrt   r!   lazy)r   r^   r   ru   r_   r   r   r   rW   
csv_readerry   s              r[   r   r     s    $009N%99;...'00B6B	 
 (00B6B	>11	1||F5f5		%	%	'	'zz)T22G;ZCS/!\\((/
 ."9"99!'*"56C OOF#
 ##-f-226: 		- ,44MFMfML |$))++  	-SC %1,	-   F? ?
G	GGc               6    [        SU5      n[        U 4SU0UD6$ )u   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.

Examples:
    >>> import pyarrow as pa
    >>> import narwhals as nw
    >>>
    >>> nw.read_parquet("file.parquet", backend="pyarrow")  # doctest:+SKIP
    ┌──────────────────┐
    |Narwhals DataFrame|
    |------------------|
    |pyarrow.Table     |
    |a: int64          |
    |c: double         |
    |----              |
    |a: [[1,2]]        |
    |c: [[0.2,0.1]]    |
    └──────────────────┘
ra   r^   )r   _read_parquet_implr   s       r[   read_parquetr   *  s'    ` 6@Gf@g@@@ri   c                  [         R                  " U5      nUR                  5       nU[         R                  [         R                  [         R
                  [         R                  [         R                  1;   a  UR                  " U 40 UD6nOBU[         R                  L a  SS K
Jn  UR                  " U 40 UD6nO UR                  " SSU 0UD6n[        USS9$ ! [         a  nSn[        U5      UeS nAff = f)Nr   r   zCUnknown namespace is expected to implement `read_parquet` function.Tr   r   )r#   rm   rr   r   r   r   r   r   r   r   pyarrow.parquetparquet
read_tablert   r!   )	r   r^   r   ru   r_   r   pqry   rW   s	            r[   r   r   ^  s     $009N%99;  (44VFvF	>11	1$}}V6v6	- ,88QQ&QL |55  	-WC %1,	-s   :C 
C5"C00C5c               6    [        SU5      n[        U 4SU0UD6$ )u	  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.

Examples:
    >>> import dask.dataframe as dd
    >>> from sqlframe.duckdb import DuckDBSession
    >>> import narwhals as nw
    >>>
    >>> nw.scan_parquet("file.parquet", backend="dask").collect()  # doctest:+SKIP
    ┌──────────────────┐
    |Narwhals DataFrame|
    |------------------|
    |        a   b     |
    |     0  1   4     |
    |     1  2   5     |
    └──────────────────┘
    >>> nw.scan_parquet(
    ...     "file.parquet", backend="sqlframe", session=DuckDBSession()
    ... ).collect()  # doctest:+SKIP
    ┌──────────────────┐
    |Narwhals DataFrame|
    |------------------|
    |  pyarrow.Table   |
    |  a: int64        |
    |  b: int64        |
    |  ----            |
    |  a: [[1,2]]      |
    |  b: [[4,5]]      |
    └──────────────────┘
ra   r^   )r   _scan_parquet_implr   s       r[   scan_parquetr   {  s'    X 6@Gf@g@@@ri   c                  [         R                  " U5      nUR                  5       nU[         R                  L a  UR                  " U 40 UD6nGOWU[         R
                  [         R                  [         R                  [         R                  [         R                  1;   a  UR                  " U 40 UD6nOU[         R                  L a  SS KJn  UR                  " U 40 UD6nOUR                  5       (       a  UR!                  SS 5      =nc  Sn[#        U5      eUR$                  R'                  S5      n	U[         R(                  L a)  [+        [-        S5      5      S:  a  U	R/                  U 5      O U	R0                  " S	0 UD6R/                  U 5      nO UR                  " S	SU 0UD6n[5        U5      R7                  5       $ ! [2         a  n
Sn[3        U5      U
eS n
A
ff = f)
Nr   r   r   r   r   r   r   zCUnknown namespace is expected to implement `scan_parquet` function.r   )r#   rm   rr   r   r   r   r   r   rq   r   r   r   r   r   r   r   r   rO   r   r   r   r+   r   r   r   rt   r!   r   )r   r^   r   ru   r_   r   r   r   rW   	pq_readerry   s              r[   r   r     s    $009N%99;...'44VFvF	 
 (44VFvF	>11	1$}}V6v6		%	%	'	'zz)T22G;ZCS/!LL''	2	 ."9"99!'*"56C NN6"
 "",V,11&9 		- ,88QQ&QL |$))++  	-WC %1,	-r   c                    ^ [        U 5      mSU4S jjn[        U[        T5      S:X  a  [        R                  " 5       5      $ [        R
                  " 5       5      $ )u  Creates 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.

Examples:
    >>> import polars as pl
    >>> import narwhals as nw
    >>>
    >>> df_native = pl.DataFrame({"a": [1, 2], "b": [3, 4], "c": ["x", "z"]})
    >>> nw.from_native(df_native).select(nw.col("a", "b") * nw.col("b"))
    ┌──────────────────┐
    |Narwhals DataFrame|
    |------------------|
    |  shape: (2, 2)   |
    |  ┌─────┬─────┐   |
    |  │ a   ┆ b   │   |
    |  │ --- ┆ --- │   |
    |  │ i64 ┆ i64 │   |
    |  ╞═════╪═════╡   |
    |  │ 3   ┆ 9   │   |
    |  │ 8   ┆ 16  │   |
    |  └─────┴─────┘   |
    └──────────────────┘
c                "   > U R                   " T6 $ N)col)rY   
flat_namess    r[   funccol.<locals>.func  s    ww
##ri      rY   r   returnr   )r&   r   lenr   selector_singleselector_multi_named)namesr   r   s     @r[   r   r     sW    : J$ z?a 	$$&  ..0	 ri   c                 z   ^ [        [        U 5      5      mSU4S jjn[        U[        R                  " 5       5      $ )uE  Creates an expression that excludes columns by their name(s).

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

Returns:
    A new expression.

Examples:
    >>> import polars as pl
    >>> import narwhals as nw
    >>>
    >>> df_native = pl.DataFrame({"a": [1, 2], "b": [3, 4], "c": ["x", "z"]})
    >>> nw.from_native(df_native).select(nw.exclude("c", "a"))
    ┌──────────────────┐
    |Narwhals DataFrame|
    |------------------|
    |  shape: (2, 1)   |
    |  ┌─────┐         |
    |  │ b   │         |
    |  │ --- │         |
    |  │ i64 │         |
    |  ╞═════╡         |
    |  │ 3   │         |
    |  │ 4   │         |
    |  └─────┘         |
    └──────────────────┘
c                &   > U R                  T5      $ r   )exclude)rY   exclude_namess    r[   r   exclude.<locals>.funcB  s    {{=))ri   r   )	frozensetr&   r   r   selector_multi_unnamed)r  r   r  s     @r[   r  r  #  s0    : gen-M* l99;<<ri   c                    ^ [        U 5      mSU4S jjn[        U[        T5      S:X  a  [        R                  " 5       5      $ [        R
                  " 5       5      $ )uI  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.

Examples:
    >>> import pyarrow as pa
    >>> import narwhals as nw
    >>>
    >>> df_native = pa.table({"a": [1, 2], "b": [3, 4], "c": [0.123, 3.14]})
    >>> nw.from_native(df_native).select(nw.nth(0, 2) * 2)
    ┌──────────────────┐
    |Narwhals DataFrame|
    |------------------|
    |pyarrow.Table     |
    |a: int64          |
    |c: double         |
    |----              |
    |a: [[2,4]]        |
    |c: [[0.246,6.28]] |
    └──────────────────┘
c                "   > U R                   " T6 $ r   )nth)rY   flat_indicess    r[   r   nth.<locals>.funch  s    ww%%ri   r   r   )r&   r   r  r   r  r  )indicesr   r  s     @r[   r  r  H  sY    < 7#L& |! 	$$&  002	 ri   c                 B    [        S [        R                  " 5       5      $ )u  Instantiate an expression representing all columns.

Returns:
    A new expression.

Examples:
    >>> import pandas as pd
    >>> import narwhals as nw
    >>>
    >>> df_native = pd.DataFrame({"a": [1, 2], "b": [3.14, 0.123]})
    >>> nw.from_native(df_native).select(nw.all() * 2)
    ┌──────────────────┐
    |Narwhals DataFrame|
    |------------------|
    |      a      b    |
    |   0  2  6.280    |
    |   1  4  0.246    |
    └──────────────────┘
c                "    U R                  5       $ r   )allrY   s    r[   <lambda>all_.<locals>.<lambda>  s
    CGGIri   )r   r   r  r   ri   r[   all_r  t  s    ( %|'J'J'LMMri   c            	         SS jn [        U [        [        R                  [        R
                  [        R                  S95      $ )u  Return the number of rows.

Returns:
    A new expression.

Examples:
    >>> import polars as pl
    >>> import narwhals as nw
    >>>
    >>> df_native = pl.DataFrame({"a": [1, 2], "b": [5, None]})
    >>> nw.from_native(df_native).select(nw.len())
    ┌──────────────────┐
    |Narwhals DataFrame|
    |------------------|
    |  shape: (1, 1)   |
    |  ┌─────┐         |
    |  │ len │         |
    |  │ --- │         |
    |  │ u32 │         |
    |  ╞═════╡         |
    |  │ 2   │         |
    |  └─────┘         |
    └──────────────────┘
c                "    U R                  5       $ r   )r  r  s    r[   r   len_.<locals>.func  s    wwyri   window_kindexpansion_kindr   )r   r   r   AGGREGATIONr   NONEr   SINGLE)r   s    r[   len_r"    s:    4   "(//	
 ri   c                 .    [        U 6 R                  5       $ )ul  Sum 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.

Examples:
    >>> import pandas as pd
    >>> import narwhals as nw
    >>>
    >>> df_native = pd.DataFrame({"a": [1, 2], "b": [-1.4, 6.2]})
    >>> nw.from_native(df_native).select(nw.sum("a", "b"))
    ┌──────────────────┐
    |Narwhals DataFrame|
    |------------------|
    |       a    b     |
    |    0  3  4.8     |
    └──────────────────┘
)r   sumcolumnss    r[   r$  r$        2 =ri   c                 .    [        U 6 R                  5       $ )u?  Get 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.

Examples:
    >>> import pyarrow as pa
    >>> import narwhals as nw
    >>>
    >>> df_native = pa.table({"a": [1, 8, 3], "b": [3.14, 6.28, 42.1]})
    >>> nw.from_native(df_native).select(nw.mean("a", "b"))
    ┌─────────────────────────┐
    |   Narwhals DataFrame    |
    |-------------------------|
    |pyarrow.Table            |
    |a: double                |
    |b: double                |
    |----                     |
    |a: [[4]]                 |
    |b: [[17.173333333333336]]|
    └─────────────────────────┘
)r   meanr%  s    r[   r)  r)    s    : =ri   c                 .    [        U 6 R                  5       $ )u  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.

Examples:
    >>> import polars as pl
    >>> import narwhals as nw
    >>>
    >>> df_native = pl.DataFrame({"a": [4, 5, 2]})
    >>> nw.from_native(df_native).select(nw.median("a"))
    ┌──────────────────┐
    |Narwhals DataFrame|
    |------------------|
    |  shape: (1, 1)   |
    |  ┌─────┐         |
    |  │ a   │         |
    |  │ --- │         |
    |  │ f64 │         |
    |  ╞═════╡         |
    |  │ 4.0 │         |
    |  └─────┘         |
    └──────────────────┘
)r   medianr%  s    r[   r+  r+    s    B =!!ri   c                 .    [        U 6 R                  5       $ )u  Return 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.

Examples:
    >>> import pyarrow as pa
    >>> import narwhals as nw
    >>>
    >>> df_native = pa.table({"a": [1, 2], "b": [5, 10]})
    >>> nw.from_native(df_native).select(nw.min("a", "b"))
    ┌──────────────────┐
    |Narwhals DataFrame|
    |------------------|
    |  pyarrow.Table   |
    |  a: int64        |
    |  b: int64        |
    |  ----            |
    |  a: [[1]]        |
    |  b: [[5]]        |
    └──────────────────┘
)r   minr%  s    r[   r-  r-    s    : =ri   c                 .    [        U 6 R                  5       $ )us  Return 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.

Examples:
    >>> import pandas as pd
    >>> import narwhals as nw
    >>>
    >>> df_native = pd.DataFrame({"a": [1, 2], "b": [5, 10]})
    >>> nw.from_native(df_native).select(nw.max("a", "b"))
    ┌──────────────────┐
    |Narwhals DataFrame|
    |------------------|
    |        a   b     |
    |     0  2  10     |
    └──────────────────┘
)r   maxr%  s    r[   r/  r/  3  r'  ri   c                 n   ^ U (       d  Sn[        U5      e[        U 5      m[        U4S j[        T6 5      $ )up  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.

Examples:
    >>> import polars as pl
    >>> import narwhals as nw
    >>>
    >>> df_native = pl.DataFrame({"a": [1, 2, 3], "b": [5, 10, None]})
    >>> nw.from_native(df_native).with_columns(sum=nw.sum_horizontal("a", "b"))
    ┌────────────────────┐
    | Narwhals DataFrame |
    |--------------------|
    |shape: (3, 3)       |
    |┌─────┬──────┬─────┐|
    |│ a   ┆ b    ┆ sum │|
    |│ --- ┆ ---  ┆ --- │|
    |│ i64 ┆ i64  ┆ i64 │|
    |╞═════╪══════╪═════╡|
    |│ 1   ┆ 5    ┆ 6   │|
    |│ 2   ┆ 10   ┆ 12  │|
    |│ 3   ┆ null ┆ 3   │|
    |└─────┴──────┴─────┘|
    └────────────────────┘
z:At least one expression must be passed to `sum_horizontal`c                6   > [        X R                  /TQ7SS06$ N
str_as_litF)r   sum_horizontalrY   
flat_exprss    r[   r   sum_horizontal.<locals>.<lambda>v  $    )##
&0
=B
ri   rO   r&   r   r   exprsrW   r6  s     @r[   r4  r4  O  =    D JoJ	
 	'
3	 ri   c                 n   ^ U (       d  Sn[        U5      e[        U 5      m[        U4S j[        T6 5      $ )uh  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.

Examples:
    >>> import pyarrow as pa
    >>> import narwhals as nw
    >>>
    >>> df_native = pa.table({"a": [1, 8, 3], "b": [4, 5, None]})
    >>> nw.from_native(df_native).with_columns(h_min=nw.min_horizontal("a", "b"))
    ┌──────────────────┐
    |Narwhals DataFrame|
    |------------------|
    | pyarrow.Table    |
    | a: int64         |
    | b: int64         |
    | h_min: int64     |
    | ----             |
    | a: [[1,8,3]]     |
    | b: [[4,5,null]]  |
    | h_min: [[1,5,3]] |
    └──────────────────┘
z:At least one expression must be passed to `min_horizontal`c                6   > [        X R                  /TQ7SS06$ r2  )r   min_horizontalr5  s    r[   r   min_horizontal.<locals>.<lambda>  r8  ri   r9  r:  s     @r[   r?  r?  }  s=    @ JoJ	
 	'
3	 ri   c                 n   ^ U (       d  Sn[        U5      e[        U 5      m[        U4S j[        T6 5      $ )u  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.

Examples:
    >>> import polars as pl
    >>> import narwhals as nw
    >>>
    >>> df_native = pl.DataFrame({"a": [1, 8, 3], "b": [4, 5, None]})
    >>> nw.from_native(df_native).with_columns(h_max=nw.max_horizontal("a", "b"))
    ┌──────────────────────┐
    |  Narwhals DataFrame  |
    |----------------------|
    |shape: (3, 3)         |
    |┌─────┬──────┬───────┐|
    |│ a   ┆ b    ┆ h_max │|
    |│ --- ┆ ---  ┆ ---   │|
    |│ i64 ┆ i64  ┆ i64   │|
    |╞═════╪══════╪═══════╡|
    |│ 1   ┆ 4    ┆ 4     │|
    |│ 8   ┆ 5    ┆ 8     │|
    |│ 3   ┆ null ┆ 3     │|
    |└─────┴──────┴───────┘|
    └──────────────────────┘
z:At least one expression must be passed to `max_horizontal`c                6   > [        X R                  /TQ7SS06$ r2  )r   max_horizontalr5  s    r[   r   max_horizontal.<locals>.<lambda>  r8  ri   r9  r:  s     @r[   rC  rC    r<  ri   c                  (    \ rS rSrSS jrSS jrSrg)Wheni  c                X    [        [        U5      6 U l        [        U R                  SS9  g )Nwhen)function_name)all_horizontalr&   
_predicater   )self
predicatess     r[   __init__When.__init__  s!    ('**=>)$//Pri   c                R   ^ ^ [        U U4S j[        T R                  TSSSS95      $ )Nc                <   >^  [        T U 4S jTR                  TSS9$ )Nc                 P   > TR                  U S   5      R                  U S   5      $ )Nr   r   )rH  then)argsrY   s    r[   r  -When.then.<locals>.<lambda>.<locals>.<lambda>  s!    chhtAw/44T!W=ri   Fr3  )r   rK  )rY   rL  r   s   `r[   r  When.then.<locals>.<lambda>  s    -= ri   Fr3  allow_multi_outputto_single_output)Thenr   rK  )rL  r   s   ``r[   rS  	When.then  s2      #(!&
 	
ri   )rK  N)rM  IntoExpr | Iterable[IntoExpr]r   None)r   &IntoExpr | NonNestedLiteral | _1DArrayr   r[  )__name__
__module____qualname____firstlineno__rN  rS  __static_attributes__r   ri   r[   rF  rF    s    Q
ri   rF  c                      \ rS rSrSS jrSrg)r[  i  c                ^   ^ ^^ [        TSS9mSUU U4S jjn[        U[        T TSSSS95      $ )NFrV  c                   > TR                  U 5      n[        U TSS9n[        T5      (       a!  [        U5      (       a  UR	                  T5      nUR                  U5      $ )NFrV  )_to_compliant_exprr   r   r(   	broadcast	otherwise)rY   compliant_exprcompliant_valuekindrL  r   s      r[   r   Then.otherwise.<locals>.func  sX    !44S9N/UuMOd##(9/(J(J"1";";D"A!++O<<ri   rX  )rY   zCompliantNamespace[Any, Any]r   zCompliantExpr[Any, Any])r   r   r   )rL  r   r   rm  s   `` @r[   rj  Then.otherwise  sB    %E2	= 	=  #(!&	
 		
ri   r   N)r   r_  r   r   )r`  ra  rb  rc  rj  rd  r   ri   r[   r[  r[    s    
ri   r[  c                     [        U 6 $ )u  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.

Examples:
    >>> import pandas as pd
    >>> import narwhals as nw
    >>>
    >>> data = {"a": [1, 2, 3], "b": [5, 10, 15]}
    >>> df_native = pd.DataFrame(data)
    >>> nw.from_native(df_native).with_columns(
    ...     nw.when(nw.col("a") < 3).then(5).otherwise(6).alias("a_when")
    ... )
    ┌──────────────────┐
    |Narwhals DataFrame|
    |------------------|
    |    a   b  a_when |
    | 0  1   5       5 |
    | 1  2  10       5 |
    | 2  3  15       6 |
    └──────────────────┘
)rF  )rM  s    r[   rH  rH    s    P ri   c                 n   ^ U (       d  Sn[        U5      e[        U 5      m[        U4S j[        T6 5      $ )u  Compute 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.

Examples:
    >>> import pyarrow as pa
    >>> import narwhals as nw
    >>>
    >>> data = {
    ...     "a": [False, False, True, True, False, None],
    ...     "b": [False, True, True, None, None, None],
    ... }
    >>> df_native = pa.table(data)
    >>> nw.from_native(df_native).select("a", "b", all=nw.all_horizontal("a", "b"))
    ┌─────────────────────────────────────────┐
    |           Narwhals DataFrame            |
    |-----------------------------------------|
    |pyarrow.Table                            |
    |a: bool                                  |
    |b: bool                                  |
    |all: bool                                |
    |----                                     |
    |a: [[false,false,true,true,false,null]]  |
    |b: [[false,true,true,null,null,null]]    |
    |all: [[false,false,true,null,false,null]]|
    └─────────────────────────────────────────┘

z:At least one expression must be passed to `all_horizontal`c                6   > [        X R                  /TQ7SS06$ r2  )r   rJ  r5  s    r[   r   all_horizontal.<locals>.<lambda>X  r8  ri   r9  r:  s     @r[   rJ  rJ  1  r<  ri   c           	       ^ ^ [        T 5      (       a  Sn[        U5      e[        T [        [        45      (       a  ST  3n[        U5      e[        UU 4S j[        [        R                  [        R                  [        R                  S95      $ )u  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.

Examples:
    >>> import pandas as pd
    >>> import narwhals as nw
    >>>
    >>> df_native = pd.DataFrame({"a": [1, 2]})
    >>> nw.from_native(df_native).with_columns(nw.lit(3))
    ┌──────────────────┐
    |Narwhals DataFrame|
    |------------------|
    |     a  literal   |
    |  0  1        3   |
    |  1  2        3   |
    └──────────────────┘
zvnumpy arrays are not supported as literal values. Consider using `with_columns` to create a new column from the array.z,Nested datatypes are not supported yet. Got c                (   > U R                  TT5      $ r   )lit)rY   rg   r   s    r[   r  lit.<locals>.<lambda>  s    CGGE5)ri   r  )r   rO   r   rP   tuplerQ   r   r   r   LITERALr   r   r   r!  )r   rg   rW   s   `` r[   rv  rv  _  s    2 eS 	 o%$''<UGD!#&&)"(//	
 ri   c                 n   ^ U (       d  Sn[        U5      e[        U 5      m[        U4S j[        T6 5      $ )u  Compute 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.

Examples:
    >>> import polars as pl
    >>> import narwhals as nw
    >>>
    >>> data = {
    ...     "a": [False, False, True, True, False, None],
    ...     "b": [False, True, True, None, None, None],
    ... }
    >>> df_native = pl.DataFrame(data)
    >>> nw.from_native(df_native).select("a", "b", any=nw.any_horizontal("a", "b"))
    ┌─────────────────────────┐
    |   Narwhals DataFrame    |
    |-------------------------|
    |shape: (6, 3)            |
    |┌───────┬───────┬───────┐|
    |│ a     ┆ b     ┆ any   │|
    |│ ---   ┆ ---   ┆ ---   │|
    |│ bool  ┆ bool  ┆ bool  │|
    |╞═══════╪═══════╪═══════╡|
    |│ false ┆ false ┆ false │|
    |│ false ┆ true  ┆ true  │|
    |│ true  ┆ true  ┆ true  │|
    |│ true  ┆ null  ┆ true  │|
    |│ false ┆ null  ┆ null  │|
    |│ null  ┆ null  ┆ null  │|
    |└───────┴───────┴───────┘|
    └─────────────────────────┘
z:At least one expression must be passed to `any_horizontal`c                6   > [        X R                  /TQ7SS06$ r2  )r   any_horizontalr5  s    r[   r   any_horizontal.<locals>.<lambda>  r8  ri   r9  r:  s     @r[   r|  r|    s=    L JoJ	
 	'
3	 ri   c                 n   ^ U (       d  Sn[        U5      e[        U 5      m[        U4S j[        T6 5      $ )u  Compute 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.

Examples:
    >>> import pyarrow as pa
    >>> import narwhals as nw
    >>>
    >>> data = {
    ...     "a": [1, 8, 3],
    ...     "b": [4, 5, None],
    ...     "c": ["x", "y", "z"],
    ... }
    >>> df_native = pa.table(data)

    We define a dataframe-agnostic function that computes the horizontal mean of "a"
    and "b" columns:

    >>> nw.from_native(df_native).select(nw.mean_horizontal("a", "b"))
    ┌──────────────────┐
    |Narwhals DataFrame|
    |------------------|
    | pyarrow.Table    |
    | a: double        |
    | ----             |
    | a: [[2.5,6.5,3]] |
    └──────────────────┘
z;At least one expression must be passed to `mean_horizontal`c                6   > [        X R                  /TQ7SS06$ r2  )r   mean_horizontalr5  s    r[   r  !mean_horizontal.<locals>.<lambda>  s$    )$$
'1
>C
ri   r9  r:  s     @r[   r  r    s=    D KoJ	
 	'
3	 ri   r   F	separatorignore_nullsc          
     t   ^^^ [        / [        U /5      QUQ5      m[        UUU4S j[        TSSSS.65      $ )uL  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.

Examples:
    >>> import pandas as pd
    >>> import narwhals as nw
    >>>
    >>> data = {
    ...     "a": [1, 2, 3],
    ...     "b": ["dogs", "cats", None],
    ...     "c": ["play", "swim", "walk"],
    ... }
    >>> df_native = pd.DataFrame(data)
    >>> (
    ...     nw.from_native(df_native).select(
    ...         nw.concat_str(
    ...             [
    ...                 nw.col("a") * 2,
    ...                 nw.col("b"),
    ...                 nw.col("c"),
    ...             ],
    ...             separator=" ",
    ...         ).alias("full_sentence")
    ...     )
    ... )
    ┌──────────────────┐
    |Narwhals DataFrame|
    |------------------|
    |   full_sentence  |
    | 0   2 dogs play  |
    | 1   4 cats swim  |
    | 2          None  |
    └──────────────────┘
c                2   >^  [        T UU U4S j/TQ7SS06$ )Nc                 *   > TR                   " U TTS.6$ )Nr  )
concat_str)rT  r  rY   r  s    r[   r  .concat_str.<locals>.<lambda>.<locals>.<lambda>&  s    #..ri   r3  Fr   )rY   r6  r  r  s   `r[   r  concat_str.<locals>.<lambda>$  s'    )

 
 
ri   FTrX  )r&   r   r   )r;  r  r  
more_exprsr6  s    `` @r[   r  r    sH    j 97E7+9j9:J	
 	EdUY	
 ri   )rV   zIterable[FrameT]rI   r9   r   rD   r   )re   strrf   r   rg   DType | type[DType] | Noner^   (ModuleType | Implementation | str | Noner_   ModuleType | Noner   Series[Any])re   r  rf   r   rg   r  r^   ra   r   r$   r   r  )
r}   Mapping[str, Any]r~   #Mapping[str, DType] | Schema | Noner^   r  r_   r  r   rE   )
r}   r  r~   r  r^   r  r   r$   r   rE   )r}   zMapping[str, Series[Any] | Any]r   z/tuple[dict[str, Series[Any] | Any], ModuleType])
r}   rA   r~   rB   r^   r  r_   r  r   rE   )
r}   rA   r~   rB   r^   ra   r   r$   r   rE   )r   r   r   zTypeIs[_IntoSchema])r   r3   r^   r  r_   r  r   rE   )r}   r3   r^   ra   r   r$   r   rE   )r   zdict[str, str])r   r^  )r   z5DataFrame[Any] | LazyFrame[Any] | Series[IntoSeriesT]r   z&Literal['full', 'lazy', 'interchange'])
r   r  r^   r  r_   r  r   r   r   rE   )r   r  r^   ra   r   r   r   rE   )
r   r  r^   r  r_   r  r   r   r   rF   )r   r  r^   ra   r   r   r   rF   )r  zstr | Iterable[str]r   r   )r  zint | Sequence[int]r   r   )r   r   )r&  r  r   r   )r;  r]  r   r   )rM  r]  r   rF  )r   r?   rg   r  r   r   )
r;  r]  r  r:   r  r  r  boolr   r   )
__future__r   r   r   r   r   typingr   r   r   r	   r
   r   r   r   narwhals._expression_parsingr   r   r   r   r   r   r   r   r   r   r   rN   r   r   r   r   narwhals.exceptionsr   narwhals.exprr   narwhals.seriesr    narwhals.translater!   r"   narwhals.utilsr#   r$   r%   r&   r'   r(   r)   r*   r+   r,   r-   typesr.   typing_extensionsr/   r0   narwhals._compliantr1   r2   narwhals._translater3   narwhals.dataframer4   r5   narwhals.dtypesr6   r   r8   narwhals.typingr9   r:   r;   r<   r=   r>   r?   r@   rA   rC   __annotations__rD   rT   rh   rc   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/  r4  r?  rC  rF  r[  rH  rJ  rv  r|  r  r  r   ri   r[   <module>r     sP   "  
 &          6 1 5 3 > J 9 G : 3 7 4 0 3 2 5  " * ( ) " 5 " + , + 2 ( 2 , +(162,,%&&,(++/,0((RKRX/1ABF <F fR DA )-2X
 9=*.2X
2X2X &2X
 62X (2X 2X B2Xp )--
-- &-
 /- - -4 2 374P 9=*.4P
4P/4P 6	4P
 (4P 4P 34Pn 
 /  6	 
    F"
)"4" DA CG:Q 9=*.:Q
:Q?:Q 6	:Q
 (:Q :Q B:Q~ CG:
:?: /	:
 : :D DA 9=*.	2Q 2Q 62Q (	2Q
 2Q B2Qj:
: /: 	:
 :4*:"&	>+& DA 9=*.	+=+= 6+= (	+=
 += += B+=\66>6JM668 DA 9=*.	1=1= 61= (	1=
 1= 1= B1=h*,*,>*,JM*,*,Z DA 9=*.	0A0A 60A (	0A
 0A 0A B0Af66>6JM66: DA 9=*.	LALA 6LA (	LA
 LA LA BLA^+,+,>+,JM+,+,\'T"=J(XN0$N8 @!"H@8+\)X+\
 
0
4 
.(V+\+\/d+b 	B(BB B 	B
 
Bri   