polars.LazyFrame.width#

property LazyFrame.width: int[source]#

Get the number of columns.

Returns:
int

Warning

Determining the width of a LazyFrame requires resolving its schema, which is a potentially expensive operation. Using collect_schema() is the idiomatic way to resolve the schema. This property exists only for symmetry with the DataFrame class.

See also

collect_schema
Schema.len

Examples

>>> lf = pl.LazyFrame(
...     {
...         "foo": [1, 2, 3],
...         "bar": [4, 5, 6],
...     }
... )
>>> lf.width  
2