1

我使用 Rust Polars,发现使用它有点困难,因为不太清楚如何显示所有列。

use polars::df;

// use macro
let df = df! [
    "Column A 12345678910" => ["a", "b", "c"],
    "Column B 12345678910" => [1, 2, 3],
    "Column C 12345678910" => [Some(1), None, Some(3)],
    "Column D 12345678910" => [Some(1), None, Some(3)],
    "Column E 12345678910" => [Some(1), None, Some(3)],
    "Column F 12345678910" => [1, 2, 3],
    "Column G 12345678910" => [1, 2, 3],
    "Column Z 12345678910" => [1, 2, 3],
    "Column Ex 12345678910" => [Some(1), None, Some(3)],
    "Column Fs 12345678910" => [1, 2, 3],
    "Column Ga 12345678910" => [1, 2, 3],
    "Column Zz 12345678910" => [1, 2, 3],
]?;
println!("{:?}", df);

输出

shape: (3, 12)
+----------------------+----------------------+----------------------+----------------------+-----+-----------------------+-----------------------+-----------------------+-----------------------+
| Column A 12345678910 | Column B 12345678910 | Column C 12345678910 | Column D 12345678910 | ... | Column Ex 12345678910 | Column Fs 12345678910 | Column Ga 12345678910 | Column Zz 12345678910 |
| ---                  | ---                  | ---                  | ---                  |     | ---                   | ---                   | ---                   | ---                   |
| str                  | i32                  | i32                  | i32                  |     | i32                   | i32                   | i32                   | i32                   |
+======================+======================+======================+======================+=====+=======================+=======================+=======================+=======================+
| a                    | 1                    | 1                    | 1                    | ... | 1                     | 1                     | 1                     | 1                     |
+----------------------+----------------------+----------------------+----------------------+-----+-----------------------+-----------------------+-----------------------+-----------------------+
| b                    | 2                    | null                 | null                 | ... | null                  | 2                     | 2                     | 2                     |
+----------------------+----------------------+----------------------+----------------------+-----+-----------------------+-----------------------+-----------------------+-----------------------+
| c                    | 3                    | 3                    | 3                    | ... | 3                     | 3                     | 3                     | 3                     |
+----------------------+----------------------+----------------------+----------------------+-----+-----------------------+-----------------------+-----------------------+-----------------------+

是否可以显示所有带有生锈极性的列?

4

1 回答 1

1

POLARS_FMT_MAX_COLS您可以通过设置您想要的最大列数来更改默认值。

在文档中查看更多环境变量设置:https ://pola-rs.github.io/polars/polars/index.html#config-with-env-vars

于 2022-01-24T18:49:25.887 回答