polars.Series.to_physical
-
Преобразует в физическое представление логического типа данных.
-
polars.datatypes.Date()->polars.datatypes.Int32() -
polars.datatypes.Datetime()->polars.datatypes.Int64() -
polars.datatypes.Time()->polars.datatypes.Int64() -
polars.datatypes.Duration()->polars.datatypes.Int64() -
polars.datatypes.Categorical()->polars.datatypes.UInt32() -
List(inner)->List(physical of inner) -
Array(inner)->Array(physical of inner) -
Struct(fields)->Struct(physical of fields) - Другие типы данных останутся без изменений.
Предупреждение
Физические представления являются деталью реализации и не гарантируют стабильность.
Примеры
Воспроизведение метода pd.Series.factorize из pandas.
>>> s = pl.Series("values", ["a", None, "x", "a"]) >>> s.cast(pl.Categorical).to_physical() shape: (4,) Series: 'values' [u32] [ 0 null 1 0 ] -
Series.to_physical() → Series
© 2020 Ritchie Vink
© 2022 Polars contributors
Licensed under the MIT License.
https://docs.pola.rs/api/python/stable/reference/series/api/polars.Series.to_physical.html