polars.Expr.map.entries#

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

Convert the Map to a List of Struct entries.

Each entry is a Struct with a key and a value field. Entry order is preserved. The inverse of Expr.list.to_map().

engine:In MemoryStreamingDistributed

Examples

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