Spec-Zone.ru › Polars

polars.LazyFrame.columns

property LazyFrame.columns: list[str]

Get the column names.

Returns:
list of str

A list containing the name of each column in order.

Warning

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

See also

collect_schema
Schema.names

Examples

>>> lf = pl.LazyFrame(
...     {
...         "foo": [1, 2, 3],
...         "bar": [6, 7, 8],
...         "ham": ["a", "b", "c"],
...     }
... ).select("foo", "bar")
>>> lf.columns  
['foo', 'bar']

© 2020 Ritchie Vink
© 2022 Polars contributors
Licensed under the MIT License.
https://docs.pola.rs/api/python/stable/reference/lazyframe/api/polars.LazyFrame.columns.html

Spec-Zone.ru

Настройки Оффлайн Что нового Помощь О нас
Spec-Zone .ru
спецификации, руководства, описания, API