o
    ¹­§i  ã                   @  s„   d Z ddlmZ ddlZddlmZ ddlmZ e e	¡ ddl
mZ W d  ƒ n1 s.w   Y  er;ddlmZ dd	d
„ZdS )z~
Module containing the `len` function.

Keep this function in its own module to avoid conflicts with Python's built-in `len`.
é    )ÚannotationsN)ÚTYPE_CHECKING)Ú	wrap_expr)ÚExprÚreturnr   c                   C  s   t t ¡ ƒS )u8  
    Return the number of rows in the context.

    This is similar to `COUNT(*)` in SQL.

    Returns
    -------
    Expr
        Expression of data type :class:`UInt32`.

    Examples
    --------
    >>> df = pl.DataFrame(
    ...     {
    ...         "a": [1, 2, None],
    ...         "b": [3, None, None],
    ...         "c": ["foo", "bar", "foo"],
    ...     }
    ... )
    >>> df.select(pl.len())
    shape: (1, 1)
    â”Œâ”€â”€â”€â”€â”€â”
    â”‚ len â”‚
    â”‚ --- â”‚
    â”‚ u32 â”‚
    â•žâ•â•â•â•â•â•¡
    â”‚ 3   â”‚
    â””â”€â”€â”€â”€â”€â”˜

    Generate an index column by using `len` in conjunction with :func:`int_range`.

    >>> df.select(
    ...     pl.int_range(pl.len(), dtype=pl.UInt32).alias("index"),
    ...     pl.all(),
    ... )
    shape: (3, 4)
    â”Œâ”€â”€â”€â”€â”€â”€â”€â”¬â”€â”€â”€â”€â”€â”€â”¬â”€â”€â”€â”€â”€â”€â”¬â”€â”€â”€â”€â”€â”
    â”‚ index â”† a    â”† b    â”† c   â”‚
    â”‚ ---   â”† ---  â”† ---  â”† --- â”‚
    â”‚ u32   â”† i64  â”† i64  â”† str â”‚
    â•žâ•â•â•â•â•â•â•â•ªâ•â•â•â•â•â•â•ªâ•â•â•â•â•â•â•ªâ•â•â•â•â•â•¡
    â”‚ 0     â”† 1    â”† 3    â”† foo â”‚
    â”‚ 1     â”† 2    â”† null â”† bar â”‚
    â”‚ 2     â”† null â”† null â”† foo â”‚
    â””â”€â”€â”€â”€â”€â”€â”€â”´â”€â”€â”€â”€â”€â”€â”´â”€â”€â”€â”€â”€â”€â”´â”€â”€â”€â”€â”€â”˜
    )r   ÚplrÚlen© r	   r	   úK/home/app/Keep/.python/lib/python3.10/site-packages/polars/functions/len.pyr      s   /r   )r   r   )Ú__doc__Ú
__future__r   Ú
contextlibÚtypingr   Zpolars._utils.wrapr   ÚsuppressÚImportErrorZpolars._plrZ_plrr   Zpolarsr   r   r	   r	   r	   r
   Ú<module>   s    ÿ