polars.Expr.map.keys#

Expr.map.keys() → Expr[source]#

Get the keys of every map as a List, in entry order.

engine:In MemoryStreamingDistributed
Returns:
Expr

Expression of data type List of the map’s key type.

Examples

>>> df = pl.DataFrame(
...     {
...         "m": pl.Series(
...             [{"a": 1, "b": 2}, {}, None], dtype=pl.Map(pl.String, pl.Int64)
...         )
...     }
... )
>>> df.select(pl.col("m").map.keys())
shape: (3, 1)
┌────────────┐
│ m          │
│ ---        │
│ list[str]  │
╞════════════╡
│ ["a", "b"] │
│ []         │
│ null       │
└────────────┘