在极地中是否有等同于pandas dtypes的命令?



我想获得数据帧中列的类型以及列的名称,但是polar只能给我类型。

我试过了。dtypes df.dtypes()。我希望得到每一列的名称及其旁边的类型。

可以在DataFrameLazyFrame对象上使用.schema

import polars as pl
from datetime import time
df = pl.DataFrame({
"a": [1, 2, 3],
"b": [True, False, True],
"c": [[{"a": time(12, 1, 1)}], None, None]

})
df.schema
{'a': Int64, 'b': Boolean, 'c': List(Struct([Field('a': Time)]))}

最新更新