
    Lpjݔ                   2   S SK Jr  S SKrS SKJrJrJrJrJr  S SK	J
r
  S SKJrJrJrJrJrJrJr  S SKJrJr  S SKJrJrJrJrJrJrJrJrJrJ r J!r!J"r"J#r#J$r$  S SK%J&r&J'r'J(r(  S S	K)J*r*J+r+  S S
K,J-r-J.r.  S SK/J0r0  S SK1J2r2  S SK3J4r4  S SK5J6r6  S SK7J8r8  S SK9J:r:  S SK;J<r<  S SK=J>r>  S SK?J@r@  \(       aZ  S SKAJBrB  S SKJCrC  S SKDrES SKFrGS SKHrIS SKJJKrK  S SKLJMrM  S SKNJOrOJPrPJQrQJRrR  S SKSJTrTJUrU  S SK)JVrV  S SK?JWrWJXrXJYrYJZrZJ[r[J\r\J]r]J^r^J_r_J`r`JaraJbrb   " S S\\@   5      rcg)    )annotationsN)CallableIterableIteratorMappingSequence)partial)TYPE_CHECKINGAnyClassVarGenericLiteralcastoverload)ExprKindExprNode)
NO_DEFAULTImplementationVersion_Implementation_resolve_sample_size_validate_rolling_argumentsensure_typegenerate_repris_compliant_seriesis_eager_allowedis_index_selectorqualified_type_namesupports_arrow_c_streamunstable)is_numpy_arrayis_numpy_array_1dis_numpy_scalar)_validate_dtype_validate_into_dtype)ComputeErrorInvalidOperationError)Expr)colSeriesCatNamespaceSeriesDateTimeNamespaceSeriesListNamespaceSeriesStringNamespaceSeriesStructNamespace)	to_native)IntoSeriesT)
ModuleType)NoReturn)Self)CompliantSeries)EagerAllowedIntoBackend	NoDefault
PluginName)	DataFrameMultiIndexSelector)DType)ClosedIntervalFillNullStrategy	IntoDTypeModeKeepStrategyNonNestedLiteralNumericLiteralPythonLiteral
RankMethodRollingInterpolationMethodSingleIndexSelectorTemporalLiteral_1DArrayc                  	   \ rS rSr% Sr\R                  rS\S'   \	SS j5       r
\	SS j5       rSS jr      SS jr\ S         SS
 jj5       r\ S         SS jj5       r\" 5       rS\S'    SS jrSSS jjr\SS j5       r\SS j5       rSS jrSS jrSSS jjrSS jr      SS jr\	SS j5       rSS jrSS jrSS jrSS jrSS jr SS jr!\	SS j5       r"\	SS j5       r#S	S	S	S	S S!S"S#.               SS$ jjr$SS% jr%SS& jr&SS' jr'SS( jr(SS) jr)SS* jr*SS+ jr+SS, jr,SS- jr-SS. jr.SS/ jr/SS0 jr0SS1 jr1SS2 jr2SS3 jr3S!S4.SS5 jjr4S!S4.SS6 jjr5  S     SS7 jjr6SS8 jr7SS9 jr8SS: jr9SS; jr:SS< jr;SS= jr<S"S>.SS? jjr=S"S@.SSA jjr>SSB jr?SSC jr@ SS	S"S	SD.         SSE jjjrASSF jrBSSG jrC S\DS	SH.         SSI jjjrES"S"SJ.SSK jjrFSSL jrGSSM jrH   S       SSN jjrISSO jrJ S       SSP jjrKSSQ jrLSSR jrMSSS jrNSST jrOSSU jrPSSV jrQSSW jrRSSX jrSSSY jrTSSZ jrUSS[ jrVSS\ jrWSS] jrXSS^ jrYSS_ jrZSS` jr[SSa jr\SSb jr]SSc jr^SSd jr_SSe jr`SSf jraSSg jrbSSh jrcSSi jrdSSj jreSSk jrfSSl jrgSSm jrhSSn jriSSo jrjSSp jrkSSq jrlSSr jrmSSs jrnSSt jroSSu jrpS"Sv.SSw jjrqS"S"S	S"Sx.         SSy jjrr      SSz jrsSS{ jrtSSS| jjruSSS} jjrvSSS~ jjrwSSS jjrxSS jrySS jrzSS"S.     SS jjr{SSS jjr|SS jr}\SS.SS jj5       r~\SS j5       r~SS.SS jjr~SS jrS"S>.SS jjrS"S>.SS jjrS"S>.SS jjrS"S>.SS jjrS	S"S.       SS jjrS	S"S.       SS jjrS	S"S!S.         SS jjrS	S"S!S.         SS jjrSS jrSS jrSS"Sv.SS jjjr SS	S S.       SS jjjr\GR                  4SS jjrSS jrSS jrSS jrSS jrSSS"S.         SS jjr\S"S.SS jj5       r\	SS j5       r\	SS j5       r\	SS j5       r\	SS j5       r\	SS j5       rSrg	(   SeriesC   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`][], e.g.:
        ```py
        narwhals.new_series(name="price", values=[10.5, 9.4, 1.2], backend="pandas")
        ```
zClassVar[Version]_versionc                    U R                   $ N)_compliant_seriesselfs    K/var/www/html/pdf-tiff/venv/lib/python3.13/site-packages/narwhals/series.py
_compliantSeries._compliantZ   s    %%%    c                    SSK Jn  U$ )Nr   )r>   )narwhals.dataframer>   )rU   r>   s     rV   
_dataframeSeries._dataframe^   s    0rY   c                Z    [        [        [        R                  SU R                  S95      $ )Nz_expr._from_series)series)r(   r   r   SERIESrW   rT   s    rV   _to_exprSeries._to_exprd   s$    X__&:4??S
 	
rY   c                   X l         [        U5      (       a  UR                  5       U l        g S[	        U5       S3n[        U5      e)NzQExpected Polars Series or an object which implements `__narwhals_series__`, got: .)_levelr   __narwhals_series__rS   typeAssertionError)rU   r_   levelmsgs       rV   __init__Series.__init__i   sN     ?Dv&&**, " ffjkqfresstuC %%rY   Nc                  [        U5      (       d  Sn[        U5      eU(       a  [        U5        [        R                  " U5      n[        U5      (       as  U R                  R                  R	                  U5      R                  nUR                  U5      R                  U5      nU(       a  U " UR                  U5      SS9$ U " USS9$ U SU S3n[        U5      e)u  Construct a Series from a NumPy ndarray.

Arguments:
    name: Name of resulting Series.
    values: One-dimensional data represented as a NumPy ndarray.
    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`.

Examples:
    >>> import numpy as np
    >>> import polars as pl
    >>> import narwhals as nw
    >>>
    >>> arr = np.arange(5, 10)
    >>> nw.Series.from_numpy("arr", arr, dtype=nw.Int8, backend="polars")
    ┌──────────────────┐
    | Narwhals Series  |
    |------------------|
    |shape: (5,)       |
    |Series: 'arr' [i8]|
    |[                 |
    |        5         |
    |        6         |
    |        7         |
    |        8         |
    |        9         |
    |]                 |
    └──────────────────┘
z)`from_numpy` only accepts 1D numpy arraysfullri   z support in Narwhals is lazy-only, but `Series.from_numpy` is an eager-only function.

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

    nw.Series.from_numpy(arr, backend='pyarrow').to_frame().lazy(''))r"   
ValueErrorr%   r   from_backendr   rP   	namespace	compliant
from_numpyaliasr   	clsnamevaluesdtypebackendrj   implementationnsrt   s	            rV   ru   Series.from_numpyu   s    \ !((=CS/! ''44W=N++''44^DNNBf-33D9I9>>%0??y// QQ_P``bd 	
 orY   c                  [        U5      (       a  U R                  XX4S9$ U(       a  [        U5        [        U[        5      (       d  S[        U5      < S3n[        U5      e[        R                  " U5      n[        U5      (       aP  U R                  R                  R                  U5      R                  nUR                  R                  X'XS9nU " USS9$ U SU S3n[        U5      e)	u  Construct a Series from an iterable.

Arguments:
    name: Name of resulting Series.
    values: One-dimensional data represented as an iterable.
    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`.

Examples:
    >>> import pandas as pd
    >>> import narwhals as nw
    >>>
    >>> values = [4, 1, 3, 2]
    >>> nw.Series.from_iterable("a", values, dtype=nw.UInt32, backend="pandas")
    ┌──────────────────────┐
    |   Narwhals Series    |
    |----------------------|
    |0    4                |
    |1    1                |
    |2    3                |
    |3    2                |
    |Name: a, dtype: uint32|
    └──────────────────────┘
)r|   z(Expected values to be an iterable, got: rd   )contextry   r{   rn   ro   z support in Narwhals is lazy-only, but `Series.from_iterable` is an eager-only function.

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

    nw.Series.from_iterable('a', [1,2,3], backend='pyarrow').to_frame().lazy('rp   )r!   ru   r%   
isinstancer   r   	TypeErrorr   rr   r   rP   rs   rt   _seriesfrom_iterablerq   rw   s	            rV   r   Series.from_iterable   s    R &!!>>$>GG '&(++<=PQW=X<[[\]CC. '44W=N++''44^DNNB

00 1 I y// ]]k\llnp 	
 orY   r   r}   c                    Sn[        U5      e)Na  the truth value of a Series is ambiguous

Here are some things you might want to try:
- instead of `if s`, use `if not s.is_empty()`
- instead of `s1 and s2`, use `s1 & s2`
- instead of `s1 or s2`, use `s1 | s2`
- instead of `s in [y, z]`, use `s.is_in([y, z])`
)r   )rU   rj   s     rV   __bool__Series.__bool__	  s    B 	 nrY   c                4    U R                   R                  XS9$ )N)r{   copy)rS   	__array__)rU   r{   r   s      rV   r   Series.__array__  s    %%//e/GGrY   c                    g rR    rU   idxs     rV   __getitem__Series.__getitem__      <?rY   c                    g rR   r   r   s     rV   r   r     r   rY   c                   [        U[        5      (       d*  [        U5      (       aW  UR                  R                  S;   a=  [        U[        5      (       d  [        U5      OUnU R
                  R                  U5      $ [        XR                  5       R                  5      (       a*  U R                  U R
                  R                  U5      5      n[        U5      (       d  S[        U5       S3n[        U5      e[        U[        5      (       a(  U R                  U R
                  UR
                     5      $ [        U[        5      (       a   eU R                  U R
                  U   5      $ )a<  Retrieve elements from the object using integer indexing or slicing.

Arguments:
    idx: The index, slice, or sequence of indices to retrieve.

        - If `idx` is an integer, a single element is returned.
        - If `idx` is a slice, a sequence of integers, or another Series
            (with integer values) a subset of the Series is returned.

Returns:
    A single element if `idx` is an integer, else a subset of the Series.

Examples:
    >>> import pyarrow as pa
    >>> import narwhals as nw
    >>>
    >>> s_native = pa.chunked_array([[1, 2, 3]])
    >>> nw.from_native(s_native, series_only=True)[0]
    1

    >>> nw.from_native(s_native, series_only=True)[
    ...     :2
    ... ].to_native()  # doctest:+ELLIPSIS
    <pyarrow.lib.ChunkedArray object at ...>
    [
      [
        1,
        2
      ]
    ]
>   iuz*Unexpected type for `Series.__getitem__`: z.

Hints:
- use `s.item` to select a single item.
- Use `s[indices]` to select rows positionally.
- Use `s.filter(mask)` to filter rows based on a boolean mask.)r   intr#   r{   kindrS   itemr4   	__class___with_compliant_with_nativer   rg   r   rN   )rU   r   rj   s      rV   r   r     s%   @ c3C  SYY^^z%A",S#"6"6#c(CC))..s33c>>+5566&&t'='='J'J3'OPC %%<T#YK HQ Q  C. c6""''(>(>s?T?T(UVVc3''''##D$:$:3$?@@rY   c                6    U R                   R                  5       $ rR   )rS   __native_namespace__rT   s    rV   r   Series.__native_namespace__U  s    %%::<<rY   c                   U R                   R                  n[        U5      (       a  UR                  US9$  [        R
                  R                  5       nUS:  a  S[        U5       3n[        U5      eSSK	J
n  U" U R                  5       5      nUR                  US9$ ! [         a  nS[        U5       3n[        U5      UeSnAff = f)al  Export a Series via the Arrow PyCapsule Interface.

Narwhals doesn't implement anything itself here:

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

See [PyCapsule Interface](https://arrow.apache.org/docs/dev/format/CDataInterface/PyCapsuleInterface.html)
for more.
)requested_schemazQ'pyarrow>=16.0.0' is required for `Series.__arrow_c_stream__` for object of type N)   r   r   )chunked_array)rS   nativer   __arrow_c_stream__r   PYARROW_backend_versionModuleNotFoundErrorrg   narwhals._arrow.utilsr   to_arrow)rU   r   native_series
pa_versionexcrj   r   cas           rV   r   Series.__arrow_c_stream__X  s     ..55"=11 33EU3VV	4'//@@BJ efjkxfyez{C%c**74==?+$$6F$GG # 	4efjkxfyez{C%c*3	4s   B 
C)CCc                .    U R                   R                  $ )aL  Convert Narwhals series to native series.

Examples:
    >>> import polars as pl
    >>> import narwhals as nw
    >>>
    >>> s_native = pl.Series([1, 2])
    >>> s = nw.from_native(s_native, series_only=True)
    >>> s.to_native()  # doctest: +NORMALIZE_WHITESPACE
    shape: (2,)
    Series: '' [i64]
    [
      1
      2
    ]
)rS   r   rT   s    rV   r4   Series.to_natives  s    " %%,,,rY   c                8   [        [        U 5      R                  SU R                  S9n[	        U[
        5      (       d>  [	        U[        5      (       d  U/nU R                  R                  nU" XR                  S9nUR                  5       (       a  U $ [	        U[
        5      (       d3  [	        U[        5      (       a  [	        U[        5      (       a  U/nU" US9nU R                  R                  UR                  UR                  5      nU R                  U5      $ )a  Set value(s) at the given index location(s).

Arguments:
    indices: Integer(s) representing the index location(s).
    values: Replacement values.

Note:
    This method always returns a new Series, without modifying the original one.
    Using this function in a for-loop is an anti-pattern, we recommend building
    up your positions and values beforehand and doing an update in one go.

    For example, instead of

    ```python
    for i in [1, 3, 2]:
        value = some_function(i)
        s = s.scatter(i, value)
    ```

    prefer

    ```python
    positions = [1, 3, 2]
    values = [some_function(x) for x in positions]
    s = s.scatter(positions, values)
    ```

Examples:
    >>> import pyarrow as pa
    >>> import narwhals as nw
    >>>
    >>> df_native = pa.table({"a": [1, 2, 3], "b": [4, 5, 6]})
    >>> df_nw = nw.from_native(df_native)
    >>> df_nw.with_columns(df_nw["a"].scatter([0, 1], [999, 888])).to_native()
    pyarrow.Table
    a: int64
    b: int64
    ----
    a: [[999,888,3]]
    b: [[4,5,6]]
 )ry   r|   )rz   r{   )rz   )r	   rg   r   r}   r   rN   r   rP   dtypesInt64is_emptystrrW   scatterr   )rU   indicesrz   into_seriesr   results         rV   r   Series.scatter  s    \ J$$2t7J7J
 '6**gx00")]]))F!EGK&&))fh//:fc3J3J  /F((););V=N=NO##F++rY   c                8    U R                   R                  5       4$ )zGet the shape of the Series.

Examples:
    >>> import pandas as pd
    >>> import narwhals as nw
    >>>
    >>> s_native = pd.Series([1, 2, 3])
    >>> nw.from_native(s_native, series_only=True).shape
    (3,)
)rS   lenrT   s    rV   shapeSeries.shape  s     &&**,..rY   c                H    [        U[        5      (       a  UR                  $ U$ rR   )r   rN   rS   )rU   args     rV   _extract_nativeSeries._extract_native  s     c6""(((
rY   c                4    U R                  XR                  S9$ )Nro   )r   re   )rU   r_   s     rV   r   Series._with_compliant  s    ~~fKK~88rY   c                    U" U /UQ70 UD6$ )aU  Pipe function call.

Examples:
    >>> import polars as pl
    >>> import narwhals as nw
    >>> s_native = pl.Series([1, 2, 3])
    >>> s = nw.from_native(s_native, series_only=True)
    >>> s.pipe(lambda x: x + 2).to_native()  # doctest: +NORMALIZE_WHITESPACE
    shape: (3,)
    Series: '' [i64]
    [
        3
        4
        5
    ]
r   )rU   functionargskwargss       rV   pipeSeries.pipe  s    " .t.v..rY   c                R    [        SU R                  5       R                  5       5      $ )NzNarwhals Series)r   r4   __repr__rT   s    rV   r   Series.__repr__  s     .0@0I0I0KLLrY   c                ,    [        U R                  5      $ rR   r   rS   rT   s    rV   __len__Series.__len__  s    4))**rY   c                ,    [        U R                  5      $ )a  Return the number of elements in the Series.

Null values count towards the total.

Examples:
    >>> import pyarrow as pa
    >>> import narwhals as nw
    >>>
    >>> s_native = pa.chunked_array([[1, 2, None]])
    >>> nw.from_native(s_native, series_only=True).len()
    3
r   rT   s    rV   r   
Series.len  s     4))**rY   c                .    U R                   R                  $ )zGet the data type of the Series.

Examples:
    >>> import pandas as pd
    >>> import narwhals as nw
    >>>
    >>> s_native = pd.Series([1, 2, 3])
    >>> nw.from_native(s_native, series_only=True).dtype
    Int64
)rS   r{   rT   s    rV   r{   Series.dtype  s     %%+++rY   c                .    U R                   R                  $ )zGet the name of the Series.

Examples:
    >>> import polars as pl
    >>> import narwhals as nw
    >>>
    >>> s_native = pl.Series("foo", [1, 2, 3])
    >>> nw.from_native(s_native, series_only=True).name
    'foo'
)rS   ry   rT   s    rV   ry   Series.name  s     %%***rY   T   Fcomspan	half_lifealphaadjustmin_samplesignore_nullsc               ^    U R                  U R                  R                  UUUUUUUS95      $ )a[  Compute exponentially-weighted moving average.

Arguments:
    com: Specify decay in terms of center of mass, $\gamma$, with <br> $\alpha = \frac{1}{1+\gamma}\forall\gamma\geq0$
    span: Specify decay in terms of span, $\theta$, with <br> $\alpha = \frac{2}{\theta + 1} \forall \theta \geq 1$
    half_life: Specify decay in terms of half-life, $\tau$, with <br> $\alpha = 1 - \exp \left\{ \frac{ -\ln(2) }{ \tau } \right\} \forall \tau > 0$
    alpha: Specify smoothing factor alpha directly, $0 < \alpha \leq 1$.
    adjust: Divide by decaying adjustment factor in beginning periods to account for imbalance in relative weightings

        - When `adjust=True` (the default) the EW function is calculated
          using weights $w_i = (1 - \alpha)^i$
        - When `adjust=False` the EW function is calculated recursively by
          $$
          y_0=x_0
          $$
          $$
          y_t = (1 - \alpha)y_{t - 1} + \alpha x_t
          $$
    min_samples: Minimum number of observations in window required to have a value (otherwise result is null).
    ignore_nulls: Ignore missing values when calculating weights.

        - When `ignore_nulls=False` (default), weights are based on absolute
          positions.
          For example, the weights of $x_0$ and $x_2$ used in
          calculating the final weighted average of $[x_0, None, x_2]$ are
          $(1-\alpha)^2$ and $1$ if `adjust=True`, and
          $(1-\alpha)^2$ and $\alpha$ if `adjust=False`.
        - When `ignore_nulls=True`, weights are based
          on relative positions. For example, the weights of
          $x_0$ and $x_2$ used in calculating the final weighted
          average of $[x_0, None, x_2]$ are
          $1-\alpha$ and $1$ if `adjust=True`,
          and $1-\alpha$ and $\alpha$ if `adjust=False`.

Examples:
    >>> import pandas as pd
    >>> import narwhals as nw
    >>>
    >>> s_native = pd.Series(name="a", data=[1, 2, 3])
    >>> nw.from_native(s_native, series_only=True).ewm_mean(
    ...     com=1, ignore_nulls=False
    ... ).to_native()
    0    1.000000
    1    1.666667
    2    2.428571
    Name: a, dtype: float64
r   )r   rS   ewm_mean)rU   r   r   r   r   r   r   r   s           rV   r   Series.ewm_mean#  sF    t ##""++#') , 

 
	
rY   c                l    [        U5        U R                  U R                  R                  U5      5      $ )a  Cast between data types.

Arguments:
    dtype: Data type that the object will be cast into.

Examples:
    >>> import pyarrow as pa
    >>> import narwhals as nw
    >>>
    >>> s_native = pa.chunked_array([[True, False, True]])
    >>> nw.from_native(s_native, series_only=True).cast(nw.Int64).to_native()
    <pyarrow.lib.ChunkedArray object at ...>
    [
      [
        1,
        0,
        1
      ]
    ]
)r$   r   rS   r   )rU   r{   s     rV   r   Series.casti  s.    * 	##D$:$:$?$?$FGGrY   c                f    U R                  U R                  R                  5       U R                  S9$ )u  Convert to dataframe.

Examples:
    >>> import polars as pl
    >>> import narwhals as nw
    >>>
    >>> s_native = pl.Series("a", [1, 2])
    >>> nw.from_native(s_native, series_only=True).to_frame().to_native()
    shape: (2, 1)
    ┌─────┐
    │ a   │
    │ --- │
    │ i64 │
    ╞═════╡
    │ 1   │
    │ 2   │
    └─────┘
ro   )r\   rS   to_framere   rT   s    rV   r   Series.to_frame  s*    & t55>>@TTrY   c                6    U R                   R                  5       $ )a  Convert to list.

Notes:
    This function converts to Python scalars. It's typically
    more efficient to keep your data in the format native to
    your original dataframe, so we recommend only calling this
    when you absolutely need to.

Examples:
    >>> import pyarrow as pa
    >>> import narwhals as nw
    >>>
    >>> s_native = pa.chunked_array([[1, 2, 3]])
    >>> nw.from_native(s_native, series_only=True).to_list()
    [1, 2, 3]
)rS   to_listrT   s    rV   r   Series.to_list  s    " %%--//rY   c                6    U R                   R                  5       $ )zReduce this Series to the mean value.

Examples:
    >>> import pandas as pd
    >>> import narwhals as nw
    >>>
    >>> s_native = pd.Series([1.2, 4.2])
    >>> nw.from_native(s_native, series_only=True).mean()
    np.float64(2.7)
)rS   meanrT   s    rV   r   Series.mean  s     %%**,,rY   c                6    U R                   R                  5       $ )aq  Reduce this Series to the median value.

Notes:
    Results might slightly differ across backends due to differences in the underlying algorithms used to compute the median.

Examples:
    >>> import pyarrow as pa
    >>> import narwhals as nw
    >>>
    >>> s_native = pa.chunked_array([[5, 3, 8]])
    >>> nw.from_native(s_native, series_only=True).median()
    5.0
)rS   medianrT   s    rV   r   Series.median  s     %%,,..rY   c                6    U R                   R                  5       $ )a  Calculate the sample skewness of the Series.

Examples:
    >>> import polars as pl
    >>> import narwhals as nw
    >>>
    >>> s_native = pl.Series([1, 1, 2, 10, 100])
    >>> nw.from_native(s_native, series_only=True).skew()
    1.4724267269058975

Notes:
    The skewness is a measure of the asymmetry of the probability distribution.
    A perfectly symmetric distribution has a skewness of 0.
)rS   skewrT   s    rV   r   Series.skew  s     %%**,,rY   c                6    U R                   R                  5       $ )a  Compute the kurtosis (Fisher's definition) without bias correction.

Kurtosis is the fourth central moment divided by the square of the variance.
The Fisher's definition is used where 3.0 is subtracted from the result to give 0.0 for a normal distribution.

Examples:
    >>> import polars as pl
    >>> import narwhals as nw
    >>>
    >>> s_native = pl.Series([1, 1, 2, 10, 100])
    >>> nw.from_native(s_native, series_only=True).kurtosis()
    0.2106571340718002
)rS   kurtosisrT   s    rV   r   Series.kurtosis  s     %%..00rY   c                6    U R                   R                  5       $ )zReturns the number of non-null elements in the Series.

Examples:
    >>> import pyarrow as pa
    >>> import narwhals as nw
    >>>
    >>> s_native = pa.chunked_array([[1, 2, None]])
    >>> nw.from_native(s_native, series_only=True).count()
    2
)rS   countrT   s    rV   r   Series.count  s     %%++--rY   c                6    U R                   R                  5       $ )aq  Return whether any of the values in the Series are True.

If there are no non-null elements, the result is `False`.

Notes:
    Only works on Series of data type Boolean.

Examples:
    >>> import pandas as pd
    >>> import narwhals as nw
    >>>
    >>> s_native = pd.Series([False, True, False])
    >>> nw.from_native(s_native, series_only=True).any()
    np.True_
)rS   anyrT   s    rV   r   
Series.any  s      %%))++rY   c                6    U R                   R                  5       $ )a9  Return whether all values in the Series are True.

If there are no non-null elements, the result is `True`.

Examples:
    >>> import pyarrow as pa
    >>> import narwhals as nw
    >>>
    >>> s_native = pa.chunked_array([[False, True, False]])
    >>> nw.from_native(s_native, series_only=True).all()
    False
)rS   allrT   s    rV   r  
Series.all       %%))++rY   c                6    U R                   R                  5       $ )zGet the minimal value in this Series.

Examples:
    >>> import polars as pl
    >>> import narwhals as nw
    >>>
    >>> s_native = pl.Series([1, 2, 3])
    >>> nw.from_native(s_native, series_only=True).min()
    1
)rS   minrT   s    rV   r  
Series.min       %%))++rY   c                6    U R                   R                  5       $ )zGet the maximum value in this Series.

Examples:
    >>> import pandas as pd
    >>> import narwhals as nw
    >>>
    >>> s_native = pd.Series([1, 2, 3])
    >>> nw.from_native(s_native, series_only=True).max()
    np.int64(3)
)rS   maxrT   s    rV   r  
Series.max"  r	  rY   c                6    U R                   R                  5       $ )zReturns the index of the minimum value.

Examples:
    >>> import pyarrow as pa
    >>> import narwhals as nw
    >>>
    >>> s_native = pa.chunked_array([[1, 2, 3]])
    >>> nw.from_native(s_native, series_only=True).arg_min()
    0
)rS   arg_minrT   s    rV   r  Series.arg_min/       %%--//rY   c                6    U R                   R                  5       $ )zReturns the index of the maximum value.

Examples:
    >>> import polars as pl
    >>> import narwhals as nw
    >>>
    >>> s_native = pl.Series([1, 2, 3])
    >>> nw.from_native(s_native, series_only=True).arg_max()
    2
)rS   arg_maxrT   s    rV   r  Series.arg_max<  r  rY   c                6    U R                   R                  5       $ )a  Reduce this Series to the sum value.

If there are no non-null elements, the result is zero.

Examples:
    >>> import pyarrow as pa
    >>> import narwhals as nw
    >>>
    >>> s_native = pa.chunked_array([[1, 2, 3]])
    >>> nw.from_native(s_native, series_only=True).sum()
    6
)rS   sumrT   s    rV   r  
Series.sumI  r  rY   ddofc               4    U R                   R                  US9$ )a{  Get the standard deviation of this Series.

Arguments:
    ddof: "Delta Degrees of Freedom": the divisor used in the calculation is N - ddof,
            where N represents the number of elements.

Examples:
    >>> import polars as pl
    >>> import narwhals as nw
    >>>
    >>> s_native = pl.Series([1, 2, 3])
    >>> nw.from_native(s_native, series_only=True).std()
    1.0
r  )rS   stdrU   r  s     rV   r  
Series.stdX       %%))t)44rY   c               4    U R                   R                  US9$ )a{  Get the variance of this Series.

Arguments:
    ddof: "Delta Degrees of Freedom": the divisor used in the calculation is N - ddof,
            where N represents the number of elements.

Examples:
    >>> import pyarrow as pa
    >>> import narwhals as nw
    >>>
    >>> s_native = pa.chunked_array([[1, 2, 3]])
    >>> nw.from_native(s_native, series_only=True).var()
    1.0
r  )rS   varr  s     rV   r  
Series.vari  r  rY   c                x   Uc7  U R                  U R                  R                  U R                  U5      S95      $ Uc7  U R                  U R                  R	                  U R                  U5      S95      $ U R                  U R                  R                  U R                  U5      U R                  U5      S95      $ )a  Clip values in the Series.

Arguments:
    lower_bound: Lower bound value.
    upper_bound: Upper bound value.

Examples:
    >>> import pandas as pd
    >>> import narwhals as nw
    >>>
    >>> s_native = pd.Series([-1, 1, -3, 3, -5, 5])
    >>> nw.from_native(s_native, series_only=True).clip(-1, 3).to_native()
    0   -1
    1    1
    2   -1
    3    3
    4   -1
    5    3
    dtype: int64
)upper_bound)lower_bound)r#  r"  )r   rS   
clip_upperr   
clip_lowerclip)rU   r#  r"  s      rV   r&  Series.clipz  s    2 ''&&11 $ 4 4[ A 2  
 ''&&11 $ 4 4[ A 2  
 ##""'' 00= 00= ( 
 	
rY   c                6    U R                   R                  5       $ )ae  Get the first element of the Series.

Returns:
    A scalar value or `None` if the Series is empty.

Examples:
    >>> import polars as pl
    >>> import narwhals as nw
    >>>
    >>> s_native = pl.Series([1, 2, 3])
    >>> s_nw = nw.from_native(s_native, series_only=True)
    >>> s_nw.first()
    1
    >>> s_nw.filter(s_nw > 5).first() is None
    True
)rS   firstrT   s    rV   r)  Series.first  s    " %%++--rY   c                6    U R                   R                  5       $ )a5  Get the last element of the Series.

Returns:
    A scalar value or `None` if the Series is empty.

Notes:
    Null values are preserved, unless `self` is backed by a non-nullable pandas Series
    (which does not support missing values). See [boolean columns](../concepts/boolean.md) for reference.

Examples:
    >>> import pyarrow as pa
    >>> import narwhals as nw
    >>>
    >>> s_native = pa.chunked_array([[1, 2, 3]])
    >>> s_nw = nw.from_native(s_native, series_only=True)
    >>> s_nw.last()
    3
    >>> s_nw.filter(s_nw > 5).last() is None
    True
)rS   lastrT   s    rV   r,  Series.last  s    * %%**,,rY   c           	     f    U R                  U R                  R                  [        USS95      5      $ )a  Check if the elements of this Series are in the other sequence.

Arguments:
    other: Sequence of primitive type.

Examples:
    >>> import pyarrow as pa
    >>> import narwhals as nw
    >>>
    >>> s_native = pa.chunked_array([[1, 2, 3]])
    >>> s = nw.from_native(s_native, series_only=True)
    >>> s.is_in([3, 2, 8]).to_native()  # doctest: +ELLIPSIS
    <pyarrow.lib.ChunkedArray object at ...>
    [
      [
        false,
        true,
        true
      ]
    ]
T)pass_through)r   rS   is_inr4   rU   others     rV   r0  Series.is_in  s2    , ##""((5t)LM
 	
rY   c                T    U R                  U R                  R                  5       5      $ )ay  Find elements where boolean Series is True.

Examples:
    >>> import polars as pl
    >>> import narwhals as nw
    >>>
    >>> s_native = pl.Series([1, None, None, 2])
    >>> nw.from_native(
    ...     s_native, series_only=True
    ... ).is_null().arg_true().to_native()  # doctest: +NORMALIZE_WHITESPACE
    shape: (2,)
    Series: '' [u32]
    [
       1
       2
    ]
)r   rS   arg_truerT   s    rV   r5  Series.arg_true  s$    $ ##D$:$:$C$C$EFFrY   c                T    U R                  U R                  R                  5       5      $ )a  Drop null values.

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

Examples:
    >>> import pandas as pd
    >>> import narwhals as nw
    >>>
    >>> s_native = pd.Series([2, 4, None, 3, 5])
    >>> nw.from_native(s_native, series_only=True).drop_nulls().to_native()
    0    2.0
    1    4.0
    3    3.0
    4    5.0
    dtype: float64
)r   rS   
drop_nullsrT   s    rV   r8  Series.drop_nulls  s$    & ##D$:$:$E$E$GHHrY   c                T    U R                  U R                  R                  5       5      $ )a  Calculate the absolute value of each element.

Examples:
    >>> import pyarrow as pa
    >>> import narwhals as nw
    >>>
    >>> s_native = pa.chunked_array([[2, -4, 3]])
    >>> nw.from_native(
    ...     s_native, series_only=True
    ... ).abs().to_native()  # doctest: +ELLIPSIS
    <pyarrow.lib.ChunkedArray object at ...>
    [
      [
        2,
        4,
        3
      ]
    ]
)r   rS   absrT   s    rV   r;  
Series.abs  s$    ( ##D$:$:$>$>$@AArY   reversec               R    U R                  U R                  R                  US95      $ )a=  Calculate the cumulative sum.

Arguments:
    reverse: reverse the operation

Examples:
    >>> import pandas as pd
    >>> import narwhals as nw
    >>>
    >>> s_native = pd.Series([2, 4, 3])
    >>> nw.from_native(s_native, series_only=True).cum_sum().to_native()
    0    2
    1    6
    2    9
    dtype: int64
r=  )r   rS   cum_sumrU   r>  s     rV   r@  Series.cum_sum)  s)    " ##D$:$:$B$B7$B$STTrY   maintain_orderc               R    U R                  U R                  R                  US95      $ )ag  Returns unique values of the series.

Arguments:
    maintain_order: Keep the same order as the original series. This may be more
        expensive to compute. Settings this to `True` blocks the possibility
        to run on the streaming engine for Polars.

Examples:
    >>> import polars as pl
    >>> import narwhals as nw
    >>>
    >>> s_native = pl.Series([2, 4, 4, 6])
    >>> s = nw.from_native(s_native, series_only=True)
    >>> s.unique(
    ...     maintain_order=True
    ... ).to_native()  # doctest: +NORMALIZE_WHITESPACE
    shape: (3,)
    Series: '' [i64]
    [
       2
       4
       6
    ]
rC  )r   rS   unique)rU   rD  s     rV   rF  Series.unique<  s.    2 ##"")))H
 	
rY   c                T    U R                  U R                  R                  5       5      $ )a  Calculate the difference with the previous element, for each element.

Notes:
    pandas may change the dtype here, for example when introducing missing
    values in an integer column. To ensure, that the dtype doesn't change,
    you may want to use `fill_null` and `cast`. For example, to calculate
    the diff and fill missing values with `0` in a Int64 column, you could
    do:

        s.diff().fill_null(0).cast(nw.Int64)

Examples:
    >>> import pyarrow as pa
    >>> import narwhals as nw
    >>>
    >>> s_native = pa.chunked_array([[2, 4, 3]])
    >>> nw.from_native(
    ...     s_native, series_only=True
    ... ).diff().to_native()  # doctest: +ELLIPSIS
    <pyarrow.lib.ChunkedArray object at ...>
    [
      [
        null,
        2,
        -1
      ]
    ]
)r   rS   diffrT   s    rV   rI  Series.diffY  s$    : ##D$:$:$?$?$ABBrY   c                t    [        U[        SS9  U R                  U R                  R	                  U5      5      $ )a  Shift values by `n` positions.

Arguments:
    n: Number of indices to shift forward. If a negative value is passed,
        values are shifted in the opposite direction instead.

Notes:
    pandas may change the dtype here, for example when introducing missing
    values in an integer column. To ensure, that the dtype doesn't change,
    you may want to use `fill_null` and `cast`. For example, to shift
    and fill missing values with `0` in a Int64 column, you could
    do:

        s.shift(1).fill_null(0).cast(nw.Int64)

Examples:
    >>> import pandas as pd
    >>> import narwhals as nw
    >>>
    >>> s_native = pd.Series([2, 4, 3])
    >>> nw.from_native(s_native, series_only=True).shift(1).to_native()
    0    NaN
    1    2.0
    2    4.0
    dtype: float64
n)
param_name)r   r   r   rS   shiftrU   rL  s     rV   rN  Series.shiftx  s2    6 	Ass+##D$:$:$@$@$CDDrY   )fractionwith_replacementseedc               |    [        X[        U 5      US9nU R                  U R                  R	                  XSUS95      $ )a  Sample randomly from this Series.

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

Notes:
    The `sample` method returns a Series with a specified number of
    randomly selected items chosen from this Series.
    The results are not consistent across libraries.

Examples:
    >>> import polars as pl
    >>> import narwhals as nw
    >>>
    >>> s_native = pl.Series([1, 2, 3, 4])
    >>> s = nw.from_native(s_native, series_only=True)
    >>> s.sample(
    ...     fraction=1.0, with_replacement=True
    ... ).to_native()  # doctest: +SKIP
    shape: (4,)
    Series: '' [i64]
    [
       1
       4
       3
       4
    ]
)rL  rQ  heightrR  )rL  rR  rS  )r   r   r   rS   sample)rU   rL  rQ  rR  rS  sizes         rV   rV  Series.sample  sN    P $3t9GW
 ##"")) * 
 	
rY   c                R    U R                  U R                  R                  US95      $ )a  Rename the Series.

Notes:
    This method is very cheap, but does not guarantee that data
    will be copied. For example:

    ```python
    s1: nw.Series
    s2 = s1.alias("foo")
    arr = s2.to_numpy()
    arr[0] = 999
    ```

    may (depending on the backend, and on the version) result in
    `s1`'s data being modified. We recommend:

        - if you need to alias an object and don't need the original
          one around any more, just use `alias` without worrying about it.
        - if you were expecting `alias` to copy data, then explicitly call
          `.clone` before calling `alias`.

Arguments:
    name: The new name.

Examples:
    >>> import pandas as pd
    >>> import narwhals as nw
    >>>
    >>> s_native = pd.Series([1, 2, 3], name="foo")
    >>> nw.from_native(s_native, series_only=True).alias("bar").to_native()
    0    1
    1    2
    2    3
    Name: bar, dtype: int64
ry   )r   rS   rv   rU   ry   s     rV   rv   Series.alias  s*    H ##D$:$:$@$@d$@$KLLrY   c                     U R                  US9$ )a  Rename the Series.

Alias for `Series.alias()`.

Notes:
    This method is very cheap, but does not guarantee that data
    will be copied. For example:

    ```python
    s1: nw.Series
    s2 = s1.rename("foo")
    arr = s2.to_numpy()
    arr[0] = 999
    ```

    may (depending on the backend, and on the version) result in
    `s1`'s data being modified. We recommend:

        - if you need to rename an object and don't need the original
          one around any more, just use `rename` without worrying about it.
        - if you were expecting `rename` to copy data, then explicitly call
          `.clone` before calling `rename`.

Arguments:
    name: The new name.

Examples:
    >>> import polars as pl
    >>> import narwhals as nw
    >>>
    >>> s_native = pl.Series("foo", [1, 2, 3])
    >>> s = nw.from_native(s_native, series_only=True)
    >>> s.rename("bar").to_native()  # doctest: +NORMALIZE_WHITESPACE
    shape: (3,)
    Series: 'bar' [i64]
    [
       1
       2
       3
    ]
rZ  )rv   r[  s     rV   renameSeries.rename  s    T zztz$$rY   )defaultreturn_dtypec          	        UcT  [        U[        5      (       d  Sn[        U5      e[        UR	                  5       5      n[        UR                  5       5      n[        U[        5      (       d   e[        U[        5      (       d   eU R                  U R                  R                  UUU R                  U5      US95      $ )a   Replace all values by different values.

Arguments:
    old: Sequence of values to replace. It also accepts a mapping of values to
        their replacement as syntactic sugar for
        `replace_strict(old=list(mapping.keys()), new=list(mapping.values()))`.
    new: Sequence of values to replace by. Length must match the length of `old`.
    default: Set values that were not replaced to this value. If no default is
        specified, (default), an error is raised if any values were not replaced.
        Accepts expression input. Non-expression inputs are parsed as literals.
    return_dtype: The data type of the resulting expression. If set to `None`
        (default), the data type is determined automatically based on the other
        inputs.

Raises:
    InvalidOperationError: If any non-null values in the original column were not
        replaced, and no default was specified.

Examples:
    >>> import pandas as pd
    >>> import narwhals as nw
    >>>
    >>> s_native = pd.Series([3, 0, 1, 2], name="a")
    >>> nw.from_native(s_native, series_only=True).replace_strict(
    ...     [0, 1, 2, 3], ["zero", "one", "two", "three"], return_dtype=nw.String
    ... ).to_native()
    0    three
    1     zero
    2      one
    3      two
    Name: a, dtype: str

    Replace values and set a default for values not in the mapping:

    >>> s_native = pd.Series([1, 2, 3, 4], name="a")
    >>> s_default = pd.Series(["beluga", "narwhal", "orca", "vaquita"])
    >>> nw.from_native(s_native, series_only=True).replace_strict(
    ...     {1: "one", 2: "two"},
    ...     default=nw.from_native(s_default, series_only=True),
    ...     return_dtype=nw.String,
    ... ).to_native()
    0        one
    1        two
    2       orca
    3    vaquita
    Name: a, dtype: str
zB`new` argument is required if `old` argument is not a Mapping type)oldnewr`  ra  )r   r   r   listrz   keysr   r   rS   replace_strictr   )rU   rc  rd  r`  ra  rj   s         rV   rg  Series.replace_strict  s    n ;c7++Zn$szz|$Csxxz"C#x((((#x((((##""11,,W5)	 2 
 	
rY   
descending
nulls_lastc               R    U R                  U R                  R                  XS95      $ )a  Sort this Series. Place null values first.

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

Examples:
    >>> import polars as pl
    >>> import narwhals as nw
    >>>
    >>> s_native = pl.Series([5, None, 1, 2])
    >>> s = nw.from_native(s_native, series_only=True)
    >>> s.sort(descending=True).to_native()  # doctest: +NORMALIZE_WHITESPACE
    shape: (4,)
    Series: '' [i64]
    [
       null
       5
       2
       1
    ]
ri  )r   rS   sort)rU   rj  rk  s      rV   rm  Series.sorte  s.    . ##""'':'U
 	
rY   c                T    U R                  U R                  R                  5       5      $ )a6  Returns a boolean Series indicating which values are null.

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

Examples:
    >>> import pyarrow as pa
    >>> import narwhals as nw
    >>>
    >>> s_native = pa.chunked_array([[1, 2, None]])
    >>> nw.from_native(
    ...     s_native, series_only=True
    ... ).is_null().to_native()  # doctest:+ELLIPSIS
    <pyarrow.lib.ChunkedArray object at ...>
    [
      [
        false,
        false,
        true
      ]
    ]
)r   rS   is_nullrT   s    rV   rp  Series.is_null  s$    0 ##D$:$:$B$B$DEErY   c                T    U R                  U R                  R                  5       5      $ )a  Returns a boolean Series indicating which values are NaN.

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

Examples:
    >>> import pandas as pd
    >>> import narwhals as nw
    >>>
    >>> s_native = pd.Series([0.0, None, 2.0], dtype="Float64")
    >>> nw.from_native(s_native, series_only=True).is_nan().to_native()
    0    False
    1     <NA>
    2    False
    dtype: boolean
)r   rS   is_nanrT   s    rV   rs  Series.is_nan  s$    $ ##D$:$:$A$A$CDDrY   c                    Ub  Ub  Sn[        U5      eUc  Uc  Sn[        U5      eUb  US;  a  SU 3n[        U5      eU R                  U R                  R                  U R	                  U5      X#S95      $ )a$  Fill null values using the specified value.

Arguments:
    value: Value used to fill null values.
    strategy: Strategy used to fill null values.
    limit: Number of consecutive null values to fill when using the 'forward' or 'backward' strategy.

Notes:
    - pandas handles null values differently from other libraries.
      See [null_handling](../concepts/null_handling.md)
      for reference.
    - For pandas Series of `object` dtype, `fill_null` will not automatically change the
      Series' dtype as pandas used to do. Explicitly call `cast` if you want the dtype to change.

Examples:
    >>> import pandas as pd
    >>> import narwhals as nw
    >>>
    >>> s_native = pd.Series([1, 2, None])
    >>>
    >>> nw.from_native(s_native, series_only=True).fill_null(5).to_native()
    0    1.0
    1    2.0
    2    5.0
    dtype: float64

    Or using a strategy:

    >>> nw.from_native(s_native, series_only=True).fill_null(
    ...     strategy="forward", limit=1
    ... ).to_native()
    0    1.0
    1    2.0
    2    2.0
    dtype: float64
z*cannot specify both `value` and `strategy`z0must specify either a fill `value` or `strategy`>   forwardbackwardzstrategy not supported: )valuestrategylimit)rq   r   rS   	fill_nullr   )rU   rx  ry  rz  rj   s        rV   r{  Series.fill_null  s    T !5>CS/!=X-DCS/!H4K$K,XJ7CS/!##"",,**51H - 
 	
rY   c                p    U R                  U R                  R                  U R                  U5      S95      $ )a  Fill floating point NaN values with given value.

Arguments:
    value: Value used to fill NaN values.

Notes:
    This function only fills `'NaN'` values, not null ones, except for pandas
    which doesn't distinguish between them.
    See [null_handling](../concepts/null_handling.md) for reference.

Examples:
    >>> import polars as pl
    >>> import narwhals as nw
    >>> s_native = pl.Series([1.0, 2.0, float("nan"), None])
    >>> result = nw.from_native(s_native, series_only=True).fill_nan(0)
    >>> result.to_native()  # doctest: +NORMALIZE_WHITESPACE
    shape: (4,)
    Series: '' [f64]
    [
       1.0
       2.0
       0.0
       null
    ]
)rx  )r   rS   fill_nanr   )rU   rx  s     rV   r~  Series.fill_nan  s9    4 ##""++$2F2Fu2M+N
 	
rY   c                    U R                  U R                  R                  U R                  U5      U R                  U5      US95      $ )aP  Get a boolean mask of the values that are between the given lower/upper bounds.

Arguments:
    lower_bound: Lower bound value.
    upper_bound: Upper bound value.
    closed: Define which sides of the interval are closed (inclusive). Options are {"left", "right", "none", "both"}.

Notes:
    If the value of the `lower_bound` is greater than that of the `upper_bound`,
    then the values will be False, as no value can satisfy the condition.

Examples:
    >>> import pyarrow as pa
    >>> import narwhals as nw
    >>>
    >>> s_native = pa.chunked_array([[1, 2, 3, 4, 5]])
    >>> s = nw.from_native(s_native, series_only=True)
    >>> s.is_between(2, 4, "right").to_native()  # doctest: +ELLIPSIS
    <pyarrow.lib.ChunkedArray object at ...>
    [
      [
        false,
        false,
        true,
        true,
        false
      ]
    ]
)closed)r   rS   
is_betweenr   )rU   r#  r"  r  s       rV   r  Series.is_between  sP    F ##""--$$[1$$[1 . 
 	
rY   c                6    U R                   R                  5       $ )zCount the number of unique values.

Examples:
    >>> import polars as pl
    >>> import narwhals as nw
    >>>
    >>> s_native = pl.Series([1, 2, 2, 3])
    >>> nw.from_native(s_native, series_only=True).n_unique()
    3
)rS   n_uniquerT   s    rV   r  Series.n_unique0  s     %%..00rY   c                6    U R                   R                  SSS9$ )zConvert to numpy.

Examples:
    >>> import pandas as pd
    >>> import narwhals as nw
    >>>
    >>> s_native = pd.Series([1, 2, 3], name="a")
    >>> nw.from_native(s_native, series_only=True).to_numpy()
    array([1, 2, 3]...)
N)r   )rS   to_numpyrT   s    rV   r  Series.to_numpy=  s      %%..t$.??rY   c                6    U R                   R                  5       $ )a  Convert to pandas Series.

Examples:
    >>> import polars as pl
    >>> import narwhals as nw
    >>>
    >>> s_native = pl.Series("a", [1, 2, 3])
    >>> nw.from_native(s_native, series_only=True).to_pandas()
    0    1
    1    2
    2    3
    Name: a, dtype: int64
)rS   	to_pandasrT   s    rV   r  Series.to_pandasJ  s     %%//11rY   c                6    U R                   R                  5       $ )a_  Convert to polars Series.

Examples:
    >>> import pyarrow as pa
    >>> import narwhals as nw
    >>>
    >>> s_native = pa.chunked_array([[1, 2, 3]])
    >>> nw.from_native(
    ...     s_native, series_only=True
    ... ).to_polars()  # doctest: +NORMALIZE_WHITESPACE
    shape: (3,)
    Series: '' [i64]
    [
        1
        2
        3
    ]
)rS   	to_polarsrT   s    rV   r  Series.to_polarsZ  s    & %%//11rY   c                t    U R                  U R                  R                  U R                  U5      5      5      $ rR   )r   rS   __add__r   r1  s     rV   r  Series.__add__o  4    ##""**4+?+?+FG
 	
rY   c                t    U R                  U R                  R                  U R                  U5      5      5      $ rR   )r   rS   __radd__r   r1  s     rV   r  Series.__radd__t  4    ##""++D,@,@,GH
 	
rY   c                t    U R                  U R                  R                  U R                  U5      5      5      $ rR   )r   rS   __sub__r   r1  s     rV   r  Series.__sub__y  r  rY   c                t    U R                  U R                  R                  U R                  U5      5      5      $ rR   )r   rS   __rsub__r   r1  s     rV   r  Series.__rsub__~  r  rY   c                t    U R                  U R                  R                  U R                  U5      5      5      $ rR   )r   rS   __mul__r   r1  s     rV   r  Series.__mul__  r  rY   c                t    U R                  U R                  R                  U R                  U5      5      5      $ rR   )r   rS   __rmul__r   r1  s     rV   r  Series.__rmul__  r  rY   c                t    U R                  U R                  R                  U R                  U5      5      5      $ rR   )r   rS   __truediv__r   r1  s     rV   r  Series.__truediv__  s4    ##""..t/C/CE/JK
 	
rY   c                t    U R                  U R                  R                  U R                  U5      5      5      $ rR   )r   rS   __rtruediv__r   r1  s     rV   r  Series.__rtruediv__  4    ##""//0D0DU0KL
 	
rY   c                t    U R                  U R                  R                  U R                  U5      5      5      $ rR   )r   rS   __floordiv__r   r1  s     rV   r  Series.__floordiv__  r  rY   c                t    U R                  U R                  R                  U R                  U5      5      5      $ rR   )r   rS   __rfloordiv__r   r1  s     rV   r  Series.__rfloordiv__  s4    ##""001E1Ee1LM
 	
rY   c                t    U R                  U R                  R                  U R                  U5      5      5      $ rR   )r   rS   __pow__r   r1  s     rV   r  Series.__pow__  r  rY   c                t    U R                  U R                  R                  U R                  U5      5      5      $ rR   )r   rS   __rpow__r   r1  s     rV   r  Series.__rpow__  r  rY   c                t    U R                  U R                  R                  U R                  U5      5      5      $ rR   )r   rS   __mod__r   r1  s     rV   r  Series.__mod__  r  rY   c                t    U R                  U R                  R                  U R                  U5      5      5      $ rR   )r   rS   __rmod__r   r1  s     rV   r  Series.__rmod__  r  rY   c                t    U R                  U R                  R                  U R                  U5      5      5      $ rR   )r   rS   __eq__r   r1  s     rV   r  Series.__eq__  4    ##""))$*>*>u*EF
 	
rY   c                t    U R                  U R                  R                  U R                  U5      5      5      $ rR   )r   rS   __ne__r   r1  s     rV   r  Series.__ne__  r  rY   c                t    U R                  U R                  R                  U R                  U5      5      5      $ rR   )r   rS   __gt__r   r1  s     rV   r  Series.__gt__  r  rY   c                t    U R                  U R                  R                  U R                  U5      5      5      $ rR   )r   rS   __ge__r   r1  s     rV   r  Series.__ge__  r  rY   c                t    U R                  U R                  R                  U R                  U5      5      5      $ rR   )r   rS   __lt__r   r1  s     rV   r  Series.__lt__  r  rY   c                t    U R                  U R                  R                  U R                  U5      5      5      $ rR   )r   rS   __le__r   r1  s     rV   r  Series.__le__  r  rY   c                t    U R                  U R                  R                  U R                  U5      5      5      $ rR   )r   rS   __and__r   r1  s     rV   r  Series.__and__  r  rY   c                t    U R                  U R                  R                  U R                  U5      5      5      $ rR   )r   rS   __rand__r   r1  s     rV   r  Series.__rand__  r  rY   c                t    U R                  U R                  R                  U R                  U5      5      5      $ rR   )r   rS   __or__r   r1  s     rV   r  Series.__or__  r  rY   c                t    U R                  U R                  R                  U R                  U5      5      5      $ rR   )r   rS   __ror__r   r1  s     rV   r  Series.__ror__  r  rY   c                T    U R                  U R                  R                  5       5      $ rR   )r   rS   
__invert__rT   s    rV   r  Series.__invert__  s"    ##D$:$:$E$E$GHHrY   c                T    U R                  U R                  R                  5       5      $ rR   )r   rS   __neg__rT   s    rV   r  Series.__neg__  s"    ##D$:$:$B$B$DEErY   c                t    U R                  U R                  R                  U R                  U5      5      5      $ )aM  Filter elements in the Series based on a condition.

Examples:
    >>> import pandas as pd
    >>> import narwhals as nw
    >>>
    >>> s_native = pd.Series([4, 10, 15, 34, 50])
    >>> s_nw = nw.from_native(s_native, series_only=True)
    >>> s_nw.filter(s_nw > 10).to_native()
    2    15
    3    34
    4    50
    dtype: int64
)r   rS   filterr   )rU   	predicates     rV   r  Series.filter  s6     ##""))$*>*>y*IJ
 	
rY   c                T    U R                  U R                  R                  5       5      $ )a  Get a mask of all duplicated rows in the Series.

Examples:
    >>> import pyarrow as pa
    >>> import narwhals as nw
    >>>
    >>> s_native = pa.chunked_array([[1, 2, 3, 1]])
    >>> nw.from_native(
    ...     s_native, series_only=True
    ... ).is_duplicated().to_native()  # doctest: +ELLIPSIS
    <pyarrow.lib.ChunkedArray object at ...>
    [
      [
        true,
        false,
        false,
        true
      ]
    ]
)r   rS   is_duplicatedrT   s    rV   r  Series.is_duplicated  s$    * ##D$:$:$H$H$JKKrY   c                6    U R                   R                  5       $ )a#  Check if the series is empty.

Examples:
    >>> import polars as pl
    >>> import narwhals as nw
    >>>
    >>> s_native = pl.Series([1, 2, 3])
    >>> s_nw = nw.from_native(s_native, series_only=True)

    >>> s_nw.is_empty()
    False
    >>> s_nw.filter(s_nw > 10).is_empty()
    True
)rS   r   rT   s    rV   r   Series.is_empty  s     %%..00rY   c                T    U R                  U R                  R                  5       5      $ )a<  Get a mask of all unique rows in the Series.

Examples:
    >>> import pandas as pd
    >>> import narwhals as nw
    >>>
    >>> s_native = pd.Series([1, 2, 3, 1])
    >>> nw.from_native(s_native, series_only=True).is_unique().to_native()
    0    False
    1     True
    2     True
    3    False
    dtype: bool
)r   rS   	is_uniquerT   s    rV   r  Series.is_unique*  s$     ##D$:$:$D$D$FGGrY   c                6    U R                   R                  5       $ )a}  Count the number of null values.

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

Examples:
    >>> import pyarrow as pa
    >>> import narwhals as nw
    >>>
    >>> s_native = pa.chunked_array([[1, None, None]])
    >>> nw.from_native(s_native, series_only=True).null_count()
    2
)rS   
null_countrT   s    rV   r  Series.null_count;  s     %%0022rY   c                T    U R                  U R                  R                  5       5      $ )a  Return a boolean mask indicating the first occurrence of each distinct value.

Examples:
    >>> import polars as pl
    >>> import narwhals as nw
    >>>
    >>> s_native = pl.Series([1, 1, 2, 3, 2])
    >>> nw.from_native(
    ...     s_native, series_only=True
    ... ).is_first_distinct().to_native()  # doctest: +NORMALIZE_WHITESPACE
    shape: (5,)
    Series: '' [bool]
    [
        true
        false
        true
        true
        false
    ]
)r   rS   is_first_distinctrT   s    rV   r  Series.is_first_distinctL  s$    * ##D$:$:$L$L$NOOrY   c                T    U R                  U R                  R                  5       5      $ )au  Return a boolean mask indicating the last occurrence of each distinct value.

Examples:
    >>> import pandas as pd
    >>> import narwhals as nw
    >>>
    >>> s_native = pd.Series([1, 1, 2, 3, 2])
    >>> nw.from_native(s_native, series_only=True).is_last_distinct().to_native()
    0    False
    1     True
    2    False
    3     True
    4     True
    dtype: bool
)r   rS   is_last_distinctrT   s    rV   r  Series.is_last_distinctc  s$      ##D$:$:$K$K$MNNrY   rj  c               4    U R                   R                  US9$ )a  Check if the Series is sorted.

Arguments:
    descending: Check if the Series is sorted in descending order.

Examples:
    >>> import pyarrow as pa
    >>> import narwhals as nw
    >>>
    >>> s_native = pa.chunked_array([[3, 2, 1]])
    >>> s_nw = nw.from_native(s_native, series_only=True)

    >>> s_nw.is_sorted(descending=False)
    False

    >>> s_nw.is_sorted(descending=True)
    True
r  )rS   	is_sorted)rU   rj  s     rV   r  Series.is_sortedu  s    & %%//:/FFrY   rm  parallelry   	normalizec          	     f    U R                  U R                  R                  XX4S9U R                  S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

        - The original values as first column
        - Either count or proportion as second column, depending on normalize parameter.

Examples:
    >>> import pandas as pd
    >>> import narwhals as nw
    >>>
    >>> s_native = pd.Series([1, 1, 2, 3, 2], name="s")
    >>> nw.from_native(s_native, series_only=True).value_counts(
    ...     sort=True
    ... ).to_native()
       s  count
    0  1      2
    1  2      2
    2  3      1
r  ro   )r\   rS   value_countsre   )rU   rm  r  ry   r  s        rV   r  Series.value_counts  sB    D ""//4 0  ++	  
 	
rY   c                4    U R                   R                  XS9$ )aA  Get quantile value of the series.

Note:
    pandas and Polars may have implementation differences for a given interpolation method.

Arguments:
    quantile: Quantile between 0.0 and 1.0.
    interpolation: Interpolation method.

Examples:
    >>> import polars as pl
    >>> import narwhals as nw
    >>>
    >>> s_native = pl.Series(list(range(50)))
    >>> s_nw = nw.from_native(s_native, series_only=True)
    >>> [
    ...     s_nw.quantile(quantile=q, interpolation="nearest")
    ...     for q in (0.1, 0.25, 0.5, 0.75, 0.9)
    ... ]
    [5.0, 12.0, 25.0, 37.0, 44.0]
)quantileinterpolation)rS   r  )rU   r  r  s      rV   r  Series.quantile  s%    0 %%.. / 
 	
rY   c                    U R                  U R                  R                  U R                  U5      U R                  U5      5      5      $ )a  Take values from self or other based on the given mask.

Where mask evaluates true, take values from self. Where mask evaluates false,
take values from other.

Arguments:
    mask: Boolean Series
    other: Series of same type.

Examples:
    >>> import pyarrow as pa
    >>> import narwhals as nw
    >>> data_native = pa.chunked_array([[1, 2, 3, 4, 5]])
    >>> other_native = pa.chunked_array([[5, 4, 3, 2, 1]])
    >>> mask_native = pa.chunked_array([[True, False, True, False, True]])
    >>>
    >>> data_nw = nw.from_native(data_native, series_only=True)
    >>> other_nw = nw.from_native(other_native, series_only=True)
    >>> mask_nw = nw.from_native(mask_native, series_only=True)
    >>>
    >>> data_nw.zip_with(mask_nw, other_nw).to_native()  # doctest: +ELLIPSIS
    <pyarrow.lib.ChunkedArray object at ...>
    [
      [
        1,
        4,
        3,
        2,
        5
      ]
    ]
)r   rS   zip_withr   )rU   maskr2  s      rV   r  Series.zip_with  sG    B ##""++$$T*D,@,@,G
 	
rY   c                    Ub+  U[        U 5      :  a  SU S[        U 5       3n[        U5      eU R                  R                  US9$ )a  Return the Series as a scalar, or return the element at the given index.

If no index is provided, this is equivalent to `s[0]`, with a check
that the shape is (1,). With an index, this is equivalent to `s[index]`.

Examples:
    >>> import polars as pl
    >>> import narwhals as nw
    >>>
    >>> nw.from_native(pl.Series("a", [1]), series_only=True).item()
    1

    >>> nw.from_native(pl.Series("a", [9, 8, 7]), series_only=True).item(-1)
    7
zindex z# out of range for series of length )index)r   
IndexErrorrS   r   )rU   r
  rj   s      rV   r   Series.item  sP      #d)!35'!DSYKPCS/!%%***77rY   c                V    U R                  U R                  R                  U5      5      $ )a9  Get the first `n` rows.

Arguments:
    n: Number of rows to return.

Examples:
    >>> import pandas as pd
    >>> import narwhals as nw
    >>>
    >>> s_native = pd.Series(list(range(10)))
    >>> nw.from_native(s_native, series_only=True).head(3).to_native()
    0    0
    1    1
    2    2
    dtype: int64
)r   rS   headrO  s     rV   r  Series.head  s&    " ##D$:$:$?$?$BCCrY   c                V    U R                  U R                  R                  U5      5      $ )a  Get the last `n` rows.

Arguments:
    n: Number of rows to return.

Examples:
    >>> import pyarrow as pa
    >>> import narwhals as nw
    >>>
    >>> s_native = pa.chunked_array([list(range(10))])
    >>> s = nw.from_native(s_native, series_only=True)
    >>> s.tail(3).to_native()  # doctest: +ELLIPSIS
    <pyarrow.lib.ChunkedArray object at ...>
    [
      [
        7,
        8,
        9
      ]
    ]
)r   rS   tailrO  s     rV   r  Series.tail  s&    , ##D$:$:$?$?$BCCrY   c                V    U R                  U R                  R                  U5      5      $ )a/  Round underlying floating point data by `decimals` digits.

Arguments:
    decimals: Number of decimals to round by.

Notes:
    For values exactly halfway between rounded decimal values pandas behaves differently than Polars and Arrow.

    pandas rounds to the nearest even value (e.g. -0.5 and 0.5 round to 0.0, 1.5 and 2.5 round to 2.0, 3.5 and
    4.5 to 4.0, etc..).

    Polars and Arrow round away from 0 (e.g. -0.5 to -1.0, 0.5 to 1.0, 1.5 to 2.0, 2.5 to 3.0, etc..).

Examples:
    >>> import polars as pl
    >>> import narwhals as nw
    >>>
    >>> s_native = pl.Series([1.12345, 2.56789, 3.901234])
    >>> s = nw.from_native(s_native, series_only=True)
    >>> s.round(1).to_native()  # doctest: +NORMALIZE_WHITESPACE
    shape: (3,)
    Series: '' [f64]
    [
       1.1
       2.6
       3.9
    ]
)r   rS   round)rU   decimalss     rV   r  Series.round6  s&    : ##D$:$:$@$@$JKKrY   c                T    U R                  U R                  R                  5       5      $ )ao  Compute the numerical floor.

Examples:
    >>> import pyarrow as pa
    >>> import narwhals as nw
    >>> s_native = pa.chunked_array([[1.1, 4.3, -1.3]])
    >>> s = nw.from_native(s_native, series_only=True)
    >>> s.floor().to_native()  # doctest:+ELLIPSIS
    <pyarrow.lib.ChunkedArray object at ...>
    [
      [
        1,
        4,
        -2
      ]
    ]
)r   rS   floorrT   s    rV   r  Series.floorU  s$    $ ##D$:$:$@$@$BCCrY   c                T    U R                  U R                  R                  5       5      $ )ap  Compute the numerical ceiling.

Examples:
    >>> import pyarrow as pa
    >>> import narwhals as nw
    >>> s_native = pa.chunked_array([[1.1, 4.3, -1.3]])
    >>> s = nw.from_native(s_native, series_only=True)
    >>> s.ceil().to_native()  # doctest:+ELLIPSIS
    <pyarrow.lib.ChunkedArray object at ...>
    [
      [
        2,
        5,
        -1
      ]
    ]
)r   rS   ceilrT   s    rV   r  Series.ceili  $    $ ##D$:$:$?$?$ABBrY   _	separator
drop_firstc               d    U R                  U R                  R                  XS9U R                  S9$ )a  Get dummy/indicator variables.

Arguments:
    separator: Separator/delimiter used when generating column names.
    drop_first: Remove the first category from the variable being encoded.

Notes:
    pandas and Polars handle null values differently. Polars distinguishes
    between NaN and Null, whereas pandas doesn't.

Examples:
    >>> import pandas as pd
    >>> import narwhals as nw
    >>>
    >>> s_native = pd.Series([1, 2, 3], name="a")
    >>> s_nw = nw.from_native(s_native, series_only=True)

    >>> s_nw.to_dummies(drop_first=False).to_native()
       a_1  a_2  a_3
    0    1    0    0
    1    0    1    0
    2    0    0    1

    >>> s_nw.to_dummies(drop_first=True).to_native()
       a_2  a_3
    0    0    0
    1    1    0
    2    0    1
r  ro   )r\   rS   
to_dummiesre   )rU   r   r!  s      rV   r#  Series.to_dummies}  s9    @ ""--	-Y++  
 	
rY   c                R    U R                  U R                  R                  XS95      $ )a  Take every nth value in the Series and return as new Series.

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

Examples:
    >>> import pyarrow as pa
    >>> import narwhals as nw
    >>>
    >>> s_native = pa.chunked_array([[1, 2, 3, 4]])
    >>> nw.from_native(s_native, series_only=True).gather_every(
    ...     n=2, offset=1
    ... ).to_native()  # doctest:+ELLIPSIS
    <pyarrow.lib.ChunkedArray object at ...>
    [
      [
        2,
        4
      ]
    ]
)rL  offset)r   rS   gather_every)rU   rL  r&  s      rV   r'  Series.gather_every  s.    . ##""//!/C
 	
rY   c                6    U R                   R                  5       $ )aa  Convert to arrow.

Examples:
    >>> import polars as pl
    >>> import narwhals as nw
    >>>
    >>> s_native = pl.Series([1, 2, 3, 4])
    >>> nw.from_native(
    ...     s_native, series_only=True
    ... ).to_arrow()  # doctest:+NORMALIZE_WHITESPACE
    <pyarrow.lib.Int64Array object at ...>
    [
        1,
        2,
        3,
        4
    ]
)rS   r   rT   s    rV   r   Series.to_arrow  s    & %%..00rY   r  keepc                   g rR   r   rU   r,  s     rV   modeSeries.mode  s    =@rY   c                   g rR   r   r.  s     rV   r/  r0    s    ADrY   c                   SnX;  a  SU SU S3n[        U5      eU R                  U R                  R                  US95      nUS:X  a  UR	                  S5      $ U$ )a@  Compute the most occurring value(s).

Can return multiple values.

Note:
    For `keep="any"` a scalar is returned, while for `keep="all"` a Series in
    returned even in the case of unimodal values.

Arguments:
    keep: Whether to keep all modes or any mode found. Remark that `keep='any'`
        is not deterministic for multimodal values.

Examples:
    >>> import pandas as pd
    >>> import narwhals as nw
    >>> s_native = pd.Series([1, 1, 2, 2, 3])
    >>> nw.from_native(s_native, series_only=True).mode().sort().to_native()
    0    1
    1    2
    dtype: int64
)r  r   z`keep` must be one of z	, found ''r+  r   r   )rq   r   rS   r/  r   )rU   r,  _supported_keep_valuesrj   r   s        rV   r/  r0    sn    , "0-*+A*B)D6QRSCS/!%%d&<&<&A&At&A&LM!%v{{1~:F:rY   c                T    U R                  U R                  R                  5       5      $ )a  Returns a boolean Series indicating which values are finite.

Warning:
    Different backend handle null values differently. `is_finite` will return
    False for NaN and Null's in the Dask and pandas non-nullable backend, while
    for Polars, PyArrow and pandas nullable backends null values are kept as such.

Examples:
    >>> import pyarrow as pa
    >>> import narwhals as nw
    >>>
    >>> s_native = pa.chunked_array([[float("nan"), float("inf"), 2.0, None]])
    >>> nw.from_native(
    ...     s_native, series_only=True
    ... ).is_finite().to_native()  # doctest: +ELLIPSIS
    <pyarrow.lib.ChunkedArray object at ...>
    [
      [
        false,
        false,
        true,
        null
      ]
    ]
)r   rS   	is_finiterT   s    rV   r6  Series.is_finite  s$    4 ##D$:$:$D$D$FGGrY   c               R    U R                  U R                  R                  US95      $ )a  Return the cumulative count of the non-null values in the series.

Arguments:
    reverse: reverse the operation

Examples:
    >>> import polars as pl
    >>> import narwhals as nw
    >>>
    >>> s_native = pl.Series(["x", "k", None, "d"])
    >>> nw.from_native(s_native, series_only=True).cum_count(
    ...     reverse=True
    ... ).to_native()  # doctest:+NORMALIZE_WHITESPACE
    shape: (4,)
    Series: '' [u32]
    [
        3
        2
        1
        1
    ]
r=  )r   rS   	cum_countrA  s     rV   r9  Series.cum_count	  s)    . ##D$:$:$D$DW$D$UVVrY   c               R    U R                  U R                  R                  US95      $ )az  Return the cumulative min of the non-null values in the series.

Arguments:
    reverse: reverse the operation

Examples:
    >>> import pandas as pd
    >>> import narwhals as nw
    >>>
    >>> s_native = pd.Series([3, 1, None, 2])
    >>> nw.from_native(s_native, series_only=True).cum_min().to_native()
    0    3.0
    1    1.0
    2    NaN
    3    1.0
    dtype: float64
r=  )r   rS   cum_minrA  s     rV   r<  Series.cum_min+	  s)    $ ##D$:$:$B$B7$B$STTrY   c               R    U R                  U R                  R                  US95      $ )a  Return the cumulative max of the non-null values in the series.

Arguments:
    reverse: reverse the operation

Examples:
    >>> import pyarrow as pa
    >>> import narwhals as nw
    >>>
    >>> s_native = pa.chunked_array([[1, 3, None, 2]])
    >>> nw.from_native(
    ...     s_native, series_only=True
    ... ).cum_max().to_native()  # doctest:+ELLIPSIS
    <pyarrow.lib.ChunkedArray object at ...>
    [
      [
        1,
        3,
        null,
        3
      ]
    ]
r=  )r   rS   cum_maxrA  s     rV   r?  Series.cum_max?	  s)    0 ##D$:$:$B$B7$B$STTrY   c               R    U R                  U R                  R                  US95      $ )a  Return the cumulative product of the non-null values in the series.

Arguments:
    reverse: reverse the operation

Examples:
    >>> import polars as pl
    >>> import narwhals as nw
    >>>
    >>> s_native = pl.Series([1, 3, None, 2])
    >>> nw.from_native(
    ...     s_native, series_only=True
    ... ).cum_prod().to_native()  # doctest:+NORMALIZE_WHITESPACE
    shape: (4,)
    Series: '' [i64]
    [
       1
       3
       null
       6
    ]
r=  )r   rS   cum_prodrA  s     rV   rB  Series.cum_prodY	  s)    . ##D$:$:$C$CG$C$TUUrY   )r   centerc                   [        XS9u  p[        U 5      S:X  a  U $ U R                  U R                  R	                  XUS95      $ )a  Apply a rolling sum (moving sum) over the values.

A window of length `window_size` will traverse the values. The resulting values
will be aggregated to their sum.

The window at a given row will include the row itself and the `window_size - 1`
elements before it.

Arguments:
    window_size: The length of the window in number of elements. It must be a
        strictly positive integer.
    min_samples: The number of values in the window that should be non-null before
        computing a result. If set to `None` (default), it will be set equal to
        `window_size`. If provided, it must be a strictly positive integer, and
        less than or equal to `window_size`
    center: Set the labels at the center of the window.

Examples:
    >>> import pandas as pd
    >>> import narwhals as nw
    >>>
    >>> s_native = pd.Series([1.0, 2.0, 3.0, 4.0])
    >>> nw.from_native(s_native, series_only=True).rolling_sum(
    ...     window_size=2
    ... ).to_native()
    0    NaN
    1    3.0
    2    5.0
    3    7.0
    dtype: float64
window_sizer   r   rG  r   rD  )r   r   r   rS   rolling_sum)rU   rG  r   rD  min_samples_ints        rV   rI  Series.rolling_sumr	  sY    D (C#(
$ t9>K##""..'V / 
 	
rY   c                   [        XS9u  p[        U 5      S:X  a  U $ U R                  U R                  R	                  XUS95      $ )am  Apply a rolling mean (moving mean) over the values.

A window of length `window_size` will traverse the values. The resulting values
will be aggregated to their mean.

The window at a given row will include the row itself and the `window_size - 1`
elements before it.

Arguments:
    window_size: The length of the window in number of elements. It must be a
        strictly positive integer.
    min_samples: The number of values in the window that should be non-null before
        computing a result. If set to `None` (default), it will be set equal to
        `window_size`. If provided, it must be a strictly positive integer, and
        less than or equal to `window_size`
    center: Set the labels at the center of the window.

Examples:
    >>> import pyarrow as pa
    >>> import narwhals as nw
    >>>
    >>> s_native = pa.chunked_array([[1.0, 2.0, 3.0, 4.0]])
    >>> nw.from_native(s_native, series_only=True).rolling_mean(
    ...     window_size=2
    ... ).to_native()  # doctest:+ELLIPSIS
    <pyarrow.lib.ChunkedArray object at ...>
    [
      [
        null,
        1.5,
        2.5,
        3.5
      ]
    ]
rF  r   rH  )r   r   r   rS   rolling_mean)rU   rG  r   rD  s       rV   rM  Series.rolling_mean	  sX    L $?#$
  t9>K##""//' 0 
 	
rY   )r   rD  r  c          	         [        XS9u  p[        U 5      S:X  a  U $ U R                  U R                  R	                  XX4S95      $ )a  Apply a rolling variance (moving variance) over the values.

A window of length `window_size` will traverse the values. The resulting values
will be aggregated to their variance.

The window at a given row will include the row itself and the `window_size - 1`
elements before it.

Arguments:
    window_size: The length of the window in number of elements. It must be a
        strictly positive integer.
    min_samples: The number of values in the window that should be non-null before
        computing a result. If set to `None` (default), it will be set equal to
        `window_size`. If provided, it must be a strictly positive integer, and
        less than or equal to `window_size`.
    center: Set the labels at the center of the window.
    ddof: Delta Degrees of Freedom; the divisor for a length N window is N - ddof.

Examples:
    >>> import polars as pl
    >>> import narwhals as nw
    >>>
    >>> s_native = pl.Series([1.0, 3.0, 1.0, 4.0])
    >>> nw.from_native(s_native, series_only=True).rolling_var(
    ...     window_size=2, min_samples=1
    ... ).to_native()  # doctest:+NORMALIZE_WHITESPACE
    shape: (4,)
    Series: '' [f64]
    [
       null
       2.0
       2.0
       4.5
    ]
rF  r   rG  r   rD  r  )r   r   r   rS   rolling_varrU   rG  r   rD  r  s        rV   rQ  Series.rolling_var	  sX    V $?#$
  t9>K##""..' / 
 	
rY   c          	         [        XS9u  p[        U 5      S:X  a  U $ U R                  U R                  R	                  XX4S95      $ )a  Apply a rolling standard deviation (moving standard deviation) over the values.

A window of length `window_size` will traverse the values. The resulting values
will be aggregated to their standard deviation.

The window at a given row will include the row itself and the `window_size - 1`
elements before it.

Arguments:
    window_size: The length of the window in number of elements. It must be a
        strictly positive integer.
    min_samples: The number of values in the window that should be non-null before
        computing a result. If set to `None` (default), it will be set equal to
        `window_size`. If provided, it must be a strictly positive integer, and
        less than or equal to `window_size`.
    center: Set the labels at the center of the window.
    ddof: Delta Degrees of Freedom; the divisor for a length N window is N - ddof.

Examples:
    >>> import pandas as pd
    >>> import narwhals as nw
    >>>
    >>> s_native = pd.Series([1.0, 3.0, 1.0, 4.0])
    >>> nw.from_native(s_native, series_only=True).rolling_std(
    ...     window_size=2, min_samples=1
    ... ).to_native()
    0         NaN
    1    1.414214
    2    1.414214
    3    2.121320
    dtype: float64
rF  r   rP  )r   r   r   rS   rolling_stdrR  s        rV   rU  Series.rolling_std
  sX    P $?#$
  t9>K##""..' / 
 	
rY   c              #  T   #    U R                   R                  5        S h  vN   g  N7frR   )rS   __iter__rT   s    rV   rX  Series.__iter__A
  s     ))22444s   (&(c                8    U R                   R                  U5      $ rR   )rS   __contains__r1  s     rV   r[  Series.__contains__D
  s    %%22599rY   c                   1 SknX;  a  SU S3n[        U5      eU R                  U R                  R                  XS95      $ )a  Assign ranks to data, dealing with ties appropriately.

Notes:
    The resulting dtype may differ between backends.

Arguments:
    method: The method used to assign ranks to tied elements.
        The following methods are available (default is 'average')

        - *"average"*: The average of the ranks that would have been assigned to
            all the tied values is assigned to each value.
        - *"min"*: The minimum of the ranks that would have been assigned to all
            the tied values is assigned to each value. (This is also referred to
            as "competition" ranking.)
        - *"max"*: The maximum of the ranks that would have been assigned to all
            the tied values is assigned to each value.
        - *"dense"*: Like "min", but the rank of the next highest element is
            assigned the rank immediately after those assigned to the tied elements.
        - *"ordinal"*: All values are given a distinct rank, corresponding to the
            order that the values occur in the Series.

    descending: Rank in descending order.

Examples:
    >>> import pyarrow as pa
    >>> import narwhals as nw
    >>>
    >>> s_native = pa.chunked_array([[3, 6, 1, 1, 6]])
    >>> nw.from_native(s_native, series_only=True).rank(
    ...     method="dense"
    ... ).to_native()  # doctest:+ELLIPSIS
    <pyarrow.lib.ChunkedArray object at ...>
    [
      [
        2,
        3,
        1,
        1,
        3
      ]
    ]
>   r  r  denseaverageordinalzTRanking method must be one of {'average', 'min', 'max', 'dense', 'ordinal'}. Found 'r3  )methodrj  )rq   r   rS   rank)rU   ra  rj  supported_rank_methodsrj   s        rV   rb  Series.rankG
  s^    V "O/ $  S/!##""''v'M
 	
rY   	bin_countinclude_breakpointc          	     Z  ^ Tbm  [        U4S j[        S[        T5      5       5       5      (       a  Sn[        U5      eUb  SU< ST< 3n[        U5      eU R                  R                  TUS9nO"SnUc  UOUnU R                  R                  X#S9nU R                  XPR                  S	9$ )
u  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.

Examples:
    >>> import pandas as pd
    >>> import narwhals as nw
    >>> s_native = pd.Series([1, 3, 8, 8, 2, 1, 3], name="a")
    >>> nw.from_native(s_native, series_only=True).hist(bin_count=4)
    ┌────────────────────┐
    | Narwhals DataFrame |
    |--------------------|
    |   breakpoint  count|
    |0        2.75      3|
    |1        4.50      2|
    |2        6.25      0|
    |3        8.00      2|
    └────────────────────┘
c              3  @   >#    U  H  nTUS -
     TU   :  v   M     g7f)r   Nr   ).0r   binss     rV   	<genexpr>Series.hist.<locals>.<genexpr>
  s$     G3Fa4A;$q')3Fs   r   z bins must increase monotonicallyz>can only provide one of `bin_count` or `bins`, got: bin_count=z, bins=)rk  rg  
   re  ro   )	r   ranger   r&   rS   hist_from_binshist_from_bin_countr\   re   )rU   rk  rf  rg  rj   r   r`  s    `     rV   histSeries.hist~
  s    B G5CI3FGGG8"3''$WYLX`[_Zab"3''++::.@ ; F
 G#,#4)I++??# @ F v[[99rY   c                R    U R                  U R                  R                  US95      $ )uq  Compute the logarithm to a given base.

Arguments:
    base: Given base, defaults to `e`

Examples:
    >>> import pandas as pd
    >>> import narwhals as nw
    >>> s_native = pd.Series([1, 2, 4], name="a")
    >>> s = nw.from_native(s_native, series_only=True)
    >>> s.log(base=2)
    ┌───────────────────────┐
    |    Narwhals Series    |
    |-----------------------|
    |0    0.0               |
    |1    1.0               |
    |2    2.0               |
    |Name: a, dtype: float64|
    └───────────────────────┘
)base)r   rS   log)rU   ru  s     rV   rv  
Series.log
  s)    * ##D$:$:$>$>D$>$IJJrY   c                T    U R                  U R                  R                  5       5      $ )u)  Compute the exponent.

Examples:
    >>> import pandas as pd
    >>> import narwhals as nw
    >>> s_native = pd.Series([-1, 0, 1], name="a")
    >>> s = nw.from_native(s_native, series_only=True)
    >>> s.exp()
    ┌───────────────────────┐
    |    Narwhals Series    |
    |-----------------------|
    |0    0.367879          |
    |1    1.000000          |
    |2    2.718282          |
    |Name: a, dtype: float64|
    └───────────────────────┘
)r   rS   exprT   s    rV   ry  
Series.exp
  s$    $ ##D$:$:$>$>$@AArY   c                T    U R                  U R                  R                  5       5      $ )ui  Compute the element-wise value for the sine.

Examples:
    >>> import pandas as pd
    >>> import narwhals as nw
    >>> from math import pi
    >>> s_native = pd.Series([0, pi / 2, 3 * pi / 2], name="a")
    >>> s = nw.from_native(s_native, series_only=True)
    >>> s.sin()
    ┌───────────────────────┐
    |    Narwhals Series    |
    |-----------------------|
    |0    0.0               |
    |1    1.0               |
    |2   -1.0               |
    |Name: a, dtype: float64|
    └───────────────────────┘
)r   rS   sinrT   s    rV   r|  
Series.sin
  $    & ##D$:$:$>$>$@AArY   c                T    U R                  U R                  R                  5       5      $ )ut  Compute the element-wise value for the cosine.

Examples:
    >>> import pandas as pd
    >>> import narwhals as nw
    >>> from math import pi
    >>> s_native = pd.Series([0, pi / 2, 3 * pi / 2], name="a")
    >>> s = nw.from_native(s_native, series_only=True)
    >>> s.cos().round(4)
    ┌───────────────────────┐
    |    Narwhals Series    |
    |-----------------------|
    |0    1.0               |
    |1    0.0               |
    |2   -0.0               |
    |Name: a, dtype: float64|
    └───────────────────────┘
)r   rS   cosrT   s    rV   r  
Series.cos
  r~  rY   c                T    U R                  U R                  R                  5       5      $ )u,  Compute the square root.

Examples:
    >>> import pandas as pd
    >>> import narwhals as nw
    >>> s_native = pd.Series([1, 4, 9], name="a")
    >>> s = nw.from_native(s_native, series_only=True)
    >>> s.sqrt()
    ┌───────────────────────┐
    |    Narwhals Series    |
    |-----------------------|
    |0    1.0               |
    |1    2.0               |
    |2    3.0               |
    |Name: a, dtype: float64|
    └───────────────────────┘
)r   rS   sqrtrT   s    rV   r  Series.sqrt  r  rY   g        g&.>abs_tolrel_tol
nans_equalc                  U R                   R                  5       (       d  SU R                    S3n[        U5      eU R                  nUSL nU(       a  SOUn[	        U5      R                  XX4S9n	U(       a  U R                  U5      OU n
U
R                  5       R                  U	5      R                  U5      nU(       a  UR                  U5      OUn[        SU5      $ )a  Get a boolean mask of the values being close to the other values.

Two values `a` and `b` are considered close if the following condition holds:

$$
|a-b| \le max \{ \text{rel\_tol} \cdot max \{ |a|, |b| \}, \text{abs\_tol} \}
$$

Arguments:
    other: Values to compare with.
    abs_tol: Absolute tolerance. This is the maximum allowed absolute difference
        between two values. Must be non-negative.
    rel_tol: Relative tolerance. This is the maximum allowed difference between
        two values, relative to the larger absolute value. Must be in the range
        [0, 1).
    nans_equal: Whether NaN values should be considered equal.

Notes:
    The implementation of this method is symmetric and mirrors the behavior of
    `math.isclose`. Specifically note that this behavior is different to
    `numpy.isclose`.

Examples:
    >>> import pyarrow as pa
    >>> import narwhals as nw
    >>>
    >>> data = [1.0, float("inf"), 1.41, None, float("nan")]
    >>> s_native = pa.chunked_array([data])
    >>> s = nw.from_native(s_native, series_only=True)
    >>> s.is_close(1.4, abs_tol=0.1).to_native()  # doctest:+ELLIPSIS
    <pyarrow.lib.ChunkedArray object at ...>
    [
      [
        false,
        false,
        true,
        null,
        false
      ]
    ]
z.`is_close` operation not supported for dtype `z7`

Hint: `is_close` is only supported for numeric typesN__nw_is_close__r  r8   )r{   
is_numericr'   ry   r)   is_closer^  r   select
get_columnr   )rU   r2  r  r  r  rj   	orig_namename_is_nonetmp_nameexprr_   r   s               rV   r  Series.is_close  s    b zz$$&&@ MG G  (,, II	 D((4$)8}%%G & 
 +7X&D"))$/::8D-9y)vFF##rY   r   c               4    U R                   R                  US9$ )aG  Get a random value from the column.

Warning:
    This functionality is considered **unstable** as it diverges from the polars API.
    It may be changed at any point without it being considered a breaking change.

Arguments:
    ignore_nulls: Whether to ignore null values or not.
        If `True` and there are no not-null elements, then `None` is returned.

Examples:
    >>> import pyarrow as pa
    >>> import narwhals as nw
    >>> s_native = pa.chunked_array([[1, 2, None]])
    >>> s = nw.from_native(s_native, series_only=True)
    >>> s.any_value(ignore_nulls=True)
    1
r  )rS   	any_value)rU   r   s     rV   r  Series.any_value`  s    ( %%//\/JJrY   c                    [        U 5      $ rR   r0   rT   s    rV   r   
Series.strv      $T**rY   c                    [        U 5      $ rR   r,   rT   s    rV   dt	Series.dtz  s    &t,,rY   c                    [        U 5      $ rR   r*   rT   s    rV   cat
Series.cat~  s    !$''rY   c                    [        U 5      $ rR   r.   rT   s    rV   re  Series.list  s    "4((rY   c                    [        U 5      $ rR   r2   rT   s    rV   structSeries.struct  r  rY   )rS   re   )returnzCompliantSeries[IntoSeriesT])r  ztype[DataFrame[Any]])r  r(   )r_   r   ri   z&Literal['full', 'lazy', 'interchange']r  NonerR   )
ry   r   rz   rL   r{   IntoDType | Noner|   &IntoBackend[EagerAllowed | PluginName]r  Series[Any])
ry   r   rz   zIterable[Any]r{   r  r|   r  r  r  )r  r7   )NN)r{   r   r   zbool | Noner  rL   )r   rJ   r  r   )r   r?   r  r8   )r   z(SingleIndexSelector | MultiIndexSelectorr  
Any | Self)r  r6   )r   zobject | Noner  object)r  r5   )r   zSelf | Iterable[int] | intrz   z.Self | Iterable[PythonLiteral] | PythonLiteralr  r8   )r  z
tuple[int])r   r   r  r   )r_   r   r  r8   )r   zCallable[[Any], Self]r   r   r   r   r  r8   )r  r   )r  r   )r  r@   )r   float | Noner   r  r   r  r   r  r   boolr   r   r   r  r  r8   )r{   rC   r  r8   )r  DataFrame[Any])r  z	list[Any])r  float)r  r  )r  r  )r  r   )r  r   r  r  )r#  .Self | NumericLiteral | TemporalLiteral | Noner"  r  r  r8   )r  rG   )r2  r   r  r8   )r  r8   )r>  r  r  r8   )rD  r  r  r8   )rL  r   r  r8   )
rL  
int | NonerQ  r  rR  r  rS  r  r  r8   )ry   r   r  r8   )
rc  z!Sequence[Any] | Mapping[Any, Any]rd  zSequence[Any] | Noner`  zAny | NoDefaultra  r  r  r8   )rj  r  rk  r  r  r8   )NNN)rx  Self | NonNestedLiteralry  zFillNullStrategy | Nonerz  r  r  r8   )rx  r  r  r8   )both)r#  r  r"  r  r  rA   r  r8   )r  rL   )r  zpd.Series[Any])r  z	pl.Series)r2  r  r  r8   )r  r   r  r8   )rj  r  r  r  )
rm  r  r  r  ry   z
str | Noner  r  r  r  )r  r  r  rI   r  r  )r  r8   r2  r8   r  r8   )r
  r  r  r   )rn  )r   )r  r   r  r8   )r   r   r!  r  r  r  )rL  r   r&  r   r  r8   )r  zpa.Array[Any])r,  zLiteral['all']r  r8   )r,  zLiteral['any']r  rE   )r,  rD   r  r  )rG  r   r   r  rD  r  r  r8   )
rG  r   r   r  rD  r  r  r   r  r8   )r  zIterator[Any])r2  r   r  r  )r_  )ra  rH   rj  r  r  r8   )rk  zlist[float] | Nonerf  r  rg  r  r  r  )ru  r  r  r8   )
r2  zSelf | NumericLiteralr  r  r  r  r  r  r  r8   )r   r  r  rG   )r  zSeriesStringNamespace[Self])r  zSeriesDateTimeNamespace[Self])r  zSeriesCatNamespace[Self])r  zSeriesListNamespace[Self])r  zSeriesStructNamespace[Self])__name__
__module____qualname____firstlineno____doc__r   MAINrP   __annotations__propertyrW   r\   ra   rk   classmethodru   r   r   r}   r   r   r   r   r   r   r4   r   r   r   r   r   r   r   r   r{   ry   r   r   r   r   r   r   r   r   r   r   r  r  r  r  r  r  r  r  r&  r)  r,  r0  r5  r8  r;  r@  rF  rI  rN  rV  rv   r^  r   rg  rm  rp  rs  r{  r~  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r   r  r  r  r  r  r  r  r  r   r  r  r  r  r  r#  r'  r   r/  r6  r9  r<  r?  rB  rI  rM  rQ  rU  rX  r[  rb  rr  matherv  ry  r|  r  r  r  r    r  r   r  r  re  r  __static_attributes__r   rY   rV   rN   rN   C   sC   ( #*,,H.& &  



&
&%K
&	
& 
 #'	>> >  	> 8> 
> >@ 
 #'	;; ;  	; 8; 
; ;z '6&7NO7(
H ? ?? ?5An=H6-&A,+A, ?A, 
	A,F / /
9/&M++ , , + +  !!"&""D
 D
 	D

  D
 D
 D
 D
 D
 
D
LH0U*0&-/ -"1 .,$,,,00, "# 5" "# 5& GKFJ*
C*
 D*
 
	*
X.&-.
4G(I*B, */ U& 05 
:C>EB /
 "&!&/
/
 	/

 /
 /
 
/
b$ML*%^ %)I

 $.)-I
.I
 "I

 !I
 'I
 
I
V */5 
6F4E, *.,0 	7
&7
 *7
 	7

 
7
r
D "(	)
)
  )
 	)

 
)
V1@2 2*














































IF
(L.1"H"3"P.O$ /4 G0 '
 '
 	'

 '
 '
 
'
R

.H
	
8%
N8*D&D0L>D(C* #&%#
#
37#
	#
J
61* -2@ @D D/4 ;<H8 ,1 W2 */ U( */ U4 +0 V4 >BRW-
-
0:-
KO-
	-
` >BRW1
1
0:1
KO1
	1
n #'6
6
  	6

 6
 6
 
6
x #'3
3
  	3

 3
 3
 
3
j5:5
 5
 5
r $(3: !%#'3: 3: 	3:
 !3: 
3:j !% K.B(B*B*C0  B$$B$ 	B$
 B$ B$ 
B$H 05 K K* + + - - ( ( ) ) + +rY   rN   )d
__future__r   r  collections.abcr   r   r   r   r   	functoolsr	   typingr
   r   r   r   r   r   r   narwhals._expression_parsingr   r   narwhals._utilsr   r   r   r   r   r   r   r   r   r   r   r   r   r    narwhals.dependenciesr!   r"   r#   narwhals.dtypesr$   r%   narwhals.exceptionsr&   r'   narwhals.exprr(   narwhals.functionsr)   narwhals.series_catr+   narwhals.series_dtr-   narwhals.series_listr/   narwhals.series_strr1   narwhals.series_structr3   narwhals.translater4   narwhals.typingr5   typesr6   r7   pandaspdpolarsplpyarrowpatyping_extensionsr8   narwhals._compliantr9   narwhals._typingr:   r;   r<   r=   r[   r>   r?   r@   rA   rB   rC   rD   rE   rF   rG   rH   rI   rJ   rK   rL   rN   r   rY   rV   <module>r     s    "  K K  Q Q Q ;     U T A C  " 2 6 4 5 8 ( ' &3QQ@%    E-+W[! E-+rY   