polars.List#

class polars.List(*args: Any, **kwargs: Any)[source]#

Nested list/array type with variable length of inner lists.

__init__(inner: PolarsDataType | PythonDataType)[source]#

Nested list/array type with variable length of inner lists.

Parameters:
inner

The DataType of values within the list

Examples

>>> df = pl.DataFrame(
...     {
...         "integer_lists": [[1, 2], [3, 4]],
...         "float_lists": [[1.0, 2.0], [3.0, 4.0]],
...     }
... )
>>> df
shape: (2, 2)
┌───────────────┬─────────────┐
│ integer_lists ┆ float_lists │
│ ---           ┆ ---         │
│ list[i64]     ┆ list[f64]   │
╞═══════════════╪═════════════╡
│ [1, 2]        ┆ [1.0, 2.0]  │
│ [3, 4]        ┆ [3.0, 4.0]  │
└───────────────┴─────────────┘

Methods

__init__(inner)

Nested list/array type with variable length of inner lists.

base_type()

Return this DataType's fundamental/root type class.

is_(other)

Check if this DataType is the same as another DataType.

is_not(other)

Check if this DataType is NOT the same as another DataType.

Attributes

inner

is_nested