polars.from_dicts

polars.from_dicts(dicts: Sequence[Dict[str, Any]]) polars.internals.frame.DataFrame

Construct a DataFrame from a sequence of dictionaries.

Parameters
dicts

Sequence with dictionaries mapping column name to value

Returns
DataFrame

Examples

>>> data = [{"a": 1, "b": 4}, {"a": 2, "b": 5}, {"a": 3, "b": 6}]
>>> df = pl.from_dicts(data)
>>> df
shape: (3, 2)
┌─────┬─────┐
│ a   ┆ b   │
│ --- ┆ --- │
│ i64 ┆ i64 │
╞═════╪═════╡
│ 1   ┆ 4   │
├╌╌╌╌╌┼╌╌╌╌╌┤
│ 2   ┆ 5   │
├╌╌╌╌╌┼╌╌╌╌╌┤
│ 3   ┆ 6   │
└─────┴─────┘