Spec-Zone.ru › Polars

polars.exceptions.DataOrientationWarning

exception polars.exceptions.DataOrientationWarning

Warning issued to indicate row orientation was inferred from the inputs.

Occurs when constructing a DataFrame from a list of rows without explicitly specifying row orientation. Polars is usually able to infer the data orientation from the data and schema, but there are cases where this is not possible. This is a common source of confusion. Use the orient parameter to be explicit about the data orientation.

Examples

>>> pl.DataFrame([(1, 2, 3), (4, 5, 6)], schema=["a", "b", "c"])  
DataOrientationWarning: Row orientation inferred during DataFrame construction.
Explicitly specify the orientation by passing `orient="row"` to silence this warning.
shape: (2, 3)
┌─────┬─────┬─────┐
│ a   ┆ b   ┆ c   │
│ --- ┆ --- ┆ --- │
│ i64 ┆ i64 ┆ i64 │
╞═════╪═════╪═════╡
│ 1   ┆ 2   ┆ 3   │
│ 4   ┆ 5   ┆ 6   │
└─────┴─────┴─────┘

Pass orient="row" to silence the warning.

>>> pl.DataFrame([[1, 2, 3], [4, 5, 6]], schema=["a", "b", "c"], orient="row")
shape: (2, 3)
┌─────┬─────┬─────┐
│ a   ┆ b   ┆ c   │
│ --- ┆ --- ┆ --- │
│ i64 ┆ i64 ┆ i64 │
╞═════╪═════╪═════╡
│ 1   ┆ 2   ┆ 3   │
│ 4   ┆ 5   ┆ 6   │
└─────┴─────┴─────┘

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

Spec-Zone.ru

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