diff --git a/DESCRIPTION b/DESCRIPTION index 4b697fa11..7368f5fbc 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -35,6 +35,7 @@ Suggests: nanoarrow (>= 0.6.0), nycflights13, patrick, + quickcheck, pillar, rlang, rmarkdown, @@ -116,7 +117,7 @@ Collate: 'sql.R' 'vctrs.R' 'zzz.R' -Config/rextendr/version: 0.3.1 +Config/rextendr/version: 0.3.1.9000 VignetteBuilder: knitr Config/polars/LibVersion: 0.43.0 Config/polars/RustToolchainVersion: nightly-2024-09-19 diff --git a/tests/testthat/_snaps/dataframe.md b/tests/testthat/_snaps/dataframe.md index 2b207626e..a2d9ac9f5 100644 --- a/tests/testthat/_snaps/dataframe.md +++ b/tests/testthat/_snaps/dataframe.md @@ -4,17 +4,18 @@ df Output shape: (5, 6) - ┌─────────┬──────┬─────┬────────────┬──────────────┬──────────────┐ - │ newname ┆ a ┆ b ┆ new_column ┆ named_vector ┆ new_column_1 │ - │ --- ┆ --- ┆ --- ┆ --- ┆ --- ┆ --- │ - │ f64 ┆ f64 ┆ str ┆ f64 ┆ f64 ┆ f64 │ - ╞═════════╪══════╪═════╪════════════╪══════════════╪══════════════╡ - │ 1.0 ┆ 5.0 ┆ a ┆ 5.0 ┆ 15.0 ┆ 5.0 │ - │ 2.0 ┆ 10.0 ┆ b ┆ 4.0 ┆ 14.0 ┆ 4.0 │ - │ 3.0 ┆ 15.0 ┆ c ┆ 3.0 ┆ 13.0 ┆ 3.0 │ - │ 4.0 ┆ 20.0 ┆ d ┆ 2.0 ┆ 12.0 ┆ 2.0 │ - │ 5.0 ┆ 25.0 ┆ e ┆ 1.0 ┆ 11.0 ┆ 0.0 │ - └─────────┴──────┴─────┴────────────┴──────────────┴──────────────┘ + ┌─────────┬──────┬─────┬─────────┬────────┬────────┐ + │ newname ┆ a ┆ b ┆ new_col ┆ named_ ┆ new_co │ + │ --- ┆ --- ┆ --- ┆ umn ┆ vector ┆ lumn_1 │ + │ f64 ┆ f64 ┆ str ┆ --- ┆ --- ┆ --- │ + │ ┆ ┆ ┆ f64 ┆ f64 ┆ f64 │ + ╞═════════╪══════╪═════╪═════════╪════════╪════════╡ + │ 1.0 ┆ 5.0 ┆ a ┆ 5.0 ┆ 15.0 ┆ 5.0 │ + │ 2.0 ┆ 10.0 ┆ b ┆ 4.0 ┆ 14.0 ┆ 4.0 │ + │ 3.0 ┆ 15.0 ┆ c ┆ 3.0 ┆ 13.0 ┆ 3.0 │ + │ 4.0 ┆ 20.0 ┆ d ┆ 2.0 ┆ 12.0 ┆ 2.0 │ + │ 5.0 ┆ 25.0 ┆ e ┆ 1.0 ┆ 11.0 ┆ 0.0 │ + └─────────┴──────┴─────┴─────────┴────────┴────────┘ # DataFrame, mixed input, create and print .name=POLARS_FMT_TABLE_CELL_ALIGNMENT, .value=RIGHT @@ -22,34 +23,36 @@ df Output shape: (5, 6) - ┌─────────┬──────┬─────┬────────────┬──────────────┬──────────────┐ - │ newname ┆ a ┆ b ┆ new_column ┆ named_vector ┆ new_column_1 │ - │ --- ┆ --- ┆ --- ┆ --- ┆ --- ┆ --- │ - │ f64 ┆ f64 ┆ str ┆ f64 ┆ f64 ┆ f64 │ - ╞═════════╪══════╪═════╪════════════╪══════════════╪══════════════╡ - │ 1.0 ┆ 5.0 ┆ a ┆ 5.0 ┆ 15.0 ┆ 5.0 │ - │ 2.0 ┆ 10.0 ┆ b ┆ 4.0 ┆ 14.0 ┆ 4.0 │ - │ 3.0 ┆ 15.0 ┆ c ┆ 3.0 ┆ 13.0 ┆ 3.0 │ - │ 4.0 ┆ 20.0 ┆ d ┆ 2.0 ┆ 12.0 ┆ 2.0 │ - │ 5.0 ┆ 25.0 ┆ e ┆ 1.0 ┆ 11.0 ┆ 0.0 │ - └─────────┴──────┴─────┴────────────┴──────────────┴──────────────┘ + ┌─────────┬──────┬─────┬─────────┬────────┬────────┐ + │ newname ┆ a ┆ b ┆ new_col ┆ named_ ┆ new_co │ + │ --- ┆ --- ┆ --- ┆ umn ┆ vector ┆ lumn_1 │ + │ f64 ┆ f64 ┆ str ┆ --- ┆ --- ┆ --- │ + │ ┆ ┆ ┆ f64 ┆ f64 ┆ f64 │ + ╞═════════╪══════╪═════╪═════════╪════════╪════════╡ + │ 1.0 ┆ 5.0 ┆ a ┆ 5.0 ┆ 15.0 ┆ 5.0 │ + │ 2.0 ┆ 10.0 ┆ b ┆ 4.0 ┆ 14.0 ┆ 4.0 │ + │ 3.0 ┆ 15.0 ┆ c ┆ 3.0 ┆ 13.0 ┆ 3.0 │ + │ 4.0 ┆ 20.0 ┆ d ┆ 2.0 ┆ 12.0 ┆ 2.0 │ + │ 5.0 ┆ 25.0 ┆ e ┆ 1.0 ┆ 11.0 ┆ 0.0 │ + └─────────┴──────┴─────┴─────────┴────────┴────────┘ # DataFrame, mixed input, create and print .name=POLARS_FMT_TABLE_DATAFRAME_SHAPE_BELOW, .value=1 Code df Output - ┌─────────┬──────┬─────┬────────────┬──────────────┬──────────────┐ - │ newname ┆ a ┆ b ┆ new_column ┆ named_vector ┆ new_column_1 │ - │ --- ┆ --- ┆ --- ┆ --- ┆ --- ┆ --- │ - │ f64 ┆ f64 ┆ str ┆ f64 ┆ f64 ┆ f64 │ - ╞═════════╪══════╪═════╪════════════╪══════════════╪══════════════╡ - │ 1.0 ┆ 5.0 ┆ a ┆ 5.0 ┆ 15.0 ┆ 5.0 │ - │ 2.0 ┆ 10.0 ┆ b ┆ 4.0 ┆ 14.0 ┆ 4.0 │ - │ 3.0 ┆ 15.0 ┆ c ┆ 3.0 ┆ 13.0 ┆ 3.0 │ - │ 4.0 ┆ 20.0 ┆ d ┆ 2.0 ┆ 12.0 ┆ 2.0 │ - │ 5.0 ┆ 25.0 ┆ e ┆ 1.0 ┆ 11.0 ┆ 0.0 │ - └─────────┴──────┴─────┴────────────┴──────────────┴──────────────┘ + ┌─────────┬──────┬─────┬─────────┬────────┬────────┐ + │ newname ┆ a ┆ b ┆ new_col ┆ named_ ┆ new_co │ + │ --- ┆ --- ┆ --- ┆ umn ┆ vector ┆ lumn_1 │ + │ f64 ┆ f64 ┆ str ┆ --- ┆ --- ┆ --- │ + │ ┆ ┆ ┆ f64 ┆ f64 ┆ f64 │ + ╞═════════╪══════╪═════╪═════════╪════════╪════════╡ + │ 1.0 ┆ 5.0 ┆ a ┆ 5.0 ┆ 15.0 ┆ 5.0 │ + │ 2.0 ┆ 10.0 ┆ b ┆ 4.0 ┆ 14.0 ┆ 4.0 │ + │ 3.0 ┆ 15.0 ┆ c ┆ 3.0 ┆ 13.0 ┆ 3.0 │ + │ 4.0 ┆ 20.0 ┆ d ┆ 2.0 ┆ 12.0 ┆ 2.0 │ + │ 5.0 ┆ 25.0 ┆ e ┆ 1.0 ┆ 11.0 ┆ 0.0 │ + └─────────┴──────┴─────┴─────────┴────────┴────────┘ shape: (5, 6) # DataFrame, mixed input, create and print .name=POLARS_FMT_TABLE_FORMATTING, .value=ASCII_FULL @@ -58,21 +61,22 @@ df Output shape: (5, 6) - +---------+------+-----+------------+--------------+--------------+ - | newname | a | b | new_column | named_vector | new_column_1 | - | --- | --- | --- | --- | --- | --- | - | f64 | f64 | str | f64 | f64 | f64 | - +=================================================================+ - | 1.0 | 5.0 | a | 5.0 | 15.0 | 5.0 | - |---------+------+-----+------------+--------------+--------------| - | 2.0 | 10.0 | b | 4.0 | 14.0 | 4.0 | - |---------+------+-----+------------+--------------+--------------| - | 3.0 | 15.0 | c | 3.0 | 13.0 | 3.0 | - |---------+------+-----+------------+--------------+--------------| - | 4.0 | 20.0 | d | 2.0 | 12.0 | 2.0 | - |---------+------+-----+------------+--------------+--------------| - | 5.0 | 25.0 | e | 1.0 | 11.0 | 0.0 | - +---------+------+-----+------------+--------------+--------------+ + +---------+------+-----+---------+--------+--------+ + | newname | a | b | new_col | named_ | new_co | + | --- | --- | --- | umn | vector | lumn_1 | + | f64 | f64 | str | --- | --- | --- | + | | | | f64 | f64 | f64 | + +==================================================+ + | 1.0 | 5.0 | a | 5.0 | 15.0 | 5.0 | + |---------+------+-----+---------+--------+--------| + | 2.0 | 10.0 | b | 4.0 | 14.0 | 4.0 | + |---------+------+-----+---------+--------+--------| + | 3.0 | 15.0 | c | 3.0 | 13.0 | 3.0 | + |---------+------+-----+---------+--------+--------| + | 4.0 | 20.0 | d | 2.0 | 12.0 | 2.0 | + |---------+------+-----+---------+--------+--------| + | 5.0 | 25.0 | e | 1.0 | 11.0 | 0.0 | + +---------+------+-----+---------+--------+--------+ # DataFrame, mixed input, create and print .name=POLARS_FMT_TABLE_FORMATTING, .value=ASCII_FULL_CONDENSED @@ -80,17 +84,18 @@ df Output shape: (5, 6) - +---------+------+-----+------------+--------------+--------------+ - | newname | a | b | new_column | named_vector | new_column_1 | - | --- | --- | --- | --- | --- | --- | - | f64 | f64 | str | f64 | f64 | f64 | - +=================================================================+ - | 1.0 | 5.0 | a | 5.0 | 15.0 | 5.0 | - | 2.0 | 10.0 | b | 4.0 | 14.0 | 4.0 | - | 3.0 | 15.0 | c | 3.0 | 13.0 | 3.0 | - | 4.0 | 20.0 | d | 2.0 | 12.0 | 2.0 | - | 5.0 | 25.0 | e | 1.0 | 11.0 | 0.0 | - +---------+------+-----+------------+--------------+--------------+ + +---------+------+-----+---------+--------+--------+ + | newname | a | b | new_col | named_ | new_co | + | --- | --- | --- | umn | vector | lumn_1 | + | f64 | f64 | str | --- | --- | --- | + | | | | f64 | f64 | f64 | + +==================================================+ + | 1.0 | 5.0 | a | 5.0 | 15.0 | 5.0 | + | 2.0 | 10.0 | b | 4.0 | 14.0 | 4.0 | + | 3.0 | 15.0 | c | 3.0 | 13.0 | 3.0 | + | 4.0 | 20.0 | d | 2.0 | 12.0 | 2.0 | + | 5.0 | 25.0 | e | 1.0 | 11.0 | 0.0 | + +---------+------+-----+---------+--------+--------+ # DataFrame, mixed input, create and print .name=POLARS_FMT_TABLE_FORMATTING, .value=ASCII_NO_BORDERS @@ -98,19 +103,20 @@ df Output shape: (5, 6) - newname | a | b | new_column | named_vector | new_column_1 - --- | --- | --- | --- | --- | --- - f64 | f64 | str | f64 | f64 | f64 - ================================================================= - 1.0 | 5.0 | a | 5.0 | 15.0 | 5.0 - ---------+------+-----+------------+--------------+-------------- - 2.0 | 10.0 | b | 4.0 | 14.0 | 4.0 - ---------+------+-----+------------+--------------+-------------- - 3.0 | 15.0 | c | 3.0 | 13.0 | 3.0 - ---------+------+-----+------------+--------------+-------------- - 4.0 | 20.0 | d | 2.0 | 12.0 | 2.0 - ---------+------+-----+------------+--------------+-------------- - 5.0 | 25.0 | e | 1.0 | 11.0 | 0.0 + newname | a | b | new_col | named_v | new_col + --- | --- | --- | umn | ector | umn_1 + f64 | f64 | str | --- | --- | --- + | | | f64 | f64 | f64 + ==================================================== + 1.0 | 5.0 | a | 5.0 | 15.0 | 5.0 + ---------+------+-----+---------+---------+--------- + 2.0 | 10.0 | b | 4.0 | 14.0 | 4.0 + ---------+------+-----+---------+---------+--------- + 3.0 | 15.0 | c | 3.0 | 13.0 | 3.0 + ---------+------+-----+---------+---------+--------- + 4.0 | 20.0 | d | 2.0 | 12.0 | 2.0 + ---------+------+-----+---------+---------+--------- + 5.0 | 25.0 | e | 1.0 | 11.0 | 0.0 # DataFrame, mixed input, create and print .name=POLARS_FMT_TABLE_FORMATTING, .value=ASCII_BORDERS_ONLY @@ -118,21 +124,22 @@ df Output shape: (5, 6) - +-----------------------------------------------------------------+ - | newname a b new_column named_vector new_column_1 | - | --- --- --- --- --- --- | - | f64 f64 str f64 f64 f64 | - +=================================================================+ - | 1.0 5.0 a 5.0 15.0 5.0 | - | | - | 2.0 10.0 b 4.0 14.0 4.0 | - | | - | 3.0 15.0 c 3.0 13.0 3.0 | - | | - | 4.0 20.0 d 2.0 12.0 2.0 | - | | - | 5.0 25.0 e 1.0 11.0 0.0 | - +-----------------------------------------------------------------+ + +--------------------------------------------------+ + | newname a b new_col named_ new_co | + | --- --- --- umn vector lumn_1 | + | f64 f64 str --- --- --- | + | f64 f64 f64 | + +==================================================+ + | 1.0 5.0 a 5.0 15.0 5.0 | + | | + | 2.0 10.0 b 4.0 14.0 4.0 | + | | + | 3.0 15.0 c 3.0 13.0 3.0 | + | | + | 4.0 20.0 d 2.0 12.0 2.0 | + | | + | 5.0 25.0 e 1.0 11.0 0.0 | + +--------------------------------------------------+ # DataFrame, mixed input, create and print .name=POLARS_FMT_TABLE_FORMATTING, .value=ASCII_BORDERS_ONLY_CONDENSED @@ -140,17 +147,18 @@ df Output shape: (5, 6) - +-----------------------------------------------------------------+ - | newname a b new_column named_vector new_column_1 | - | --- --- --- --- --- --- | - | f64 f64 str f64 f64 f64 | - +=================================================================+ - | 1.0 5.0 a 5.0 15.0 5.0 | - | 2.0 10.0 b 4.0 14.0 4.0 | - | 3.0 15.0 c 3.0 13.0 3.0 | - | 4.0 20.0 d 2.0 12.0 2.0 | - | 5.0 25.0 e 1.0 11.0 0.0 | - +-----------------------------------------------------------------+ + +--------------------------------------------------+ + | newname a b new_col named_ new_co | + | --- --- --- umn vector lumn_1 | + | f64 f64 str --- --- --- | + | f64 f64 f64 | + +==================================================+ + | 1.0 5.0 a 5.0 15.0 5.0 | + | 2.0 10.0 b 4.0 14.0 4.0 | + | 3.0 15.0 c 3.0 13.0 3.0 | + | 4.0 20.0 d 2.0 12.0 2.0 | + | 5.0 25.0 e 1.0 11.0 0.0 | + +--------------------------------------------------+ # DataFrame, mixed input, create and print .name=POLARS_FMT_TABLE_FORMATTING, .value=ASCII_HORIZONTAL_ONLY @@ -158,21 +166,22 @@ df Output shape: (5, 6) - ----------------------------------------------------------------- - newname a b new_column named_vector new_column_1 - --- --- --- --- --- --- - f64 f64 str f64 f64 f64 - ================================================================= - 1.0 5.0 a 5.0 15.0 5.0 - ----------------------------------------------------------------- - 2.0 10.0 b 4.0 14.0 4.0 - ----------------------------------------------------------------- - 3.0 15.0 c 3.0 13.0 3.0 - ----------------------------------------------------------------- - 4.0 20.0 d 2.0 12.0 2.0 - ----------------------------------------------------------------- - 5.0 25.0 e 1.0 11.0 0.0 - ----------------------------------------------------------------- + ---------------------------------------------------- + newname a b new_col named_v new_col + --- --- --- umn ector umn_1 + f64 f64 str --- --- --- + f64 f64 f64 + ==================================================== + 1.0 5.0 a 5.0 15.0 5.0 + ---------------------------------------------------- + 2.0 10.0 b 4.0 14.0 4.0 + ---------------------------------------------------- + 3.0 15.0 c 3.0 13.0 3.0 + ---------------------------------------------------- + 4.0 20.0 d 2.0 12.0 2.0 + ---------------------------------------------------- + 5.0 25.0 e 1.0 11.0 0.0 + ---------------------------------------------------- # DataFrame, mixed input, create and print .name=POLARS_FMT_TABLE_FORMATTING, .value=ASCII_MARKDOWN @@ -180,15 +189,16 @@ df Output shape: (5, 6) - | newname | a | b | new_column | named_vector | new_column_1 | - | --- | --- | --- | --- | --- | --- | - | f64 | f64 | str | f64 | f64 | f64 | - |---------|------|-----|------------|--------------|--------------| - | 1.0 | 5.0 | a | 5.0 | 15.0 | 5.0 | - | 2.0 | 10.0 | b | 4.0 | 14.0 | 4.0 | - | 3.0 | 15.0 | c | 3.0 | 13.0 | 3.0 | - | 4.0 | 20.0 | d | 2.0 | 12.0 | 2.0 | - | 5.0 | 25.0 | e | 1.0 | 11.0 | 0.0 | + | newname | a | b | new_col | named_ | new_co | + | --- | --- | --- | umn | vector | lumn_1 | + | f64 | f64 | str | --- | --- | --- | + | | | | f64 | f64 | f64 | + |---------|------|-----|---------|--------|--------| + | 1.0 | 5.0 | a | 5.0 | 15.0 | 5.0 | + | 2.0 | 10.0 | b | 4.0 | 14.0 | 4.0 | + | 3.0 | 15.0 | c | 3.0 | 13.0 | 3.0 | + | 4.0 | 20.0 | d | 2.0 | 12.0 | 2.0 | + | 5.0 | 25.0 | e | 1.0 | 11.0 | 0.0 | # DataFrame, mixed input, create and print .name=POLARS_FMT_TABLE_FORMATTING, .value=UTF8_FULL @@ -196,21 +206,22 @@ df Output shape: (5, 6) - ┌─────────┬──────┬─────┬────────────┬──────────────┬──────────────┐ - │ newname ┆ a ┆ b ┆ new_column ┆ named_vector ┆ new_column_1 │ - │ --- ┆ --- ┆ --- ┆ --- ┆ --- ┆ --- │ - │ f64 ┆ f64 ┆ str ┆ f64 ┆ f64 ┆ f64 │ - ╞═════════╪══════╪═════╪════════════╪══════════════╪══════════════╡ - │ 1.0 ┆ 5.0 ┆ a ┆ 5.0 ┆ 15.0 ┆ 5.0 │ - ├╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌┼╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌┤ - │ 2.0 ┆ 10.0 ┆ b ┆ 4.0 ┆ 14.0 ┆ 4.0 │ - ├╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌┼╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌┤ - │ 3.0 ┆ 15.0 ┆ c ┆ 3.0 ┆ 13.0 ┆ 3.0 │ - ├╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌┼╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌┤ - │ 4.0 ┆ 20.0 ┆ d ┆ 2.0 ┆ 12.0 ┆ 2.0 │ - ├╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌┼╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌┤ - │ 5.0 ┆ 25.0 ┆ e ┆ 1.0 ┆ 11.0 ┆ 0.0 │ - └─────────┴──────┴─────┴────────────┴──────────────┴──────────────┘ + ┌─────────┬──────┬─────┬─────────┬────────┬────────┐ + │ newname ┆ a ┆ b ┆ new_col ┆ named_ ┆ new_co │ + │ --- ┆ --- ┆ --- ┆ umn ┆ vector ┆ lumn_1 │ + │ f64 ┆ f64 ┆ str ┆ --- ┆ --- ┆ --- │ + │ ┆ ┆ ┆ f64 ┆ f64 ┆ f64 │ + ╞═════════╪══════╪═════╪═════════╪════════╪════════╡ + │ 1.0 ┆ 5.0 ┆ a ┆ 5.0 ┆ 15.0 ┆ 5.0 │ + ├╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌┼╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌┤ + │ 2.0 ┆ 10.0 ┆ b ┆ 4.0 ┆ 14.0 ┆ 4.0 │ + ├╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌┼╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌┤ + │ 3.0 ┆ 15.0 ┆ c ┆ 3.0 ┆ 13.0 ┆ 3.0 │ + ├╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌┼╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌┤ + │ 4.0 ┆ 20.0 ┆ d ┆ 2.0 ┆ 12.0 ┆ 2.0 │ + ├╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌┼╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌┤ + │ 5.0 ┆ 25.0 ┆ e ┆ 1.0 ┆ 11.0 ┆ 0.0 │ + └─────────┴──────┴─────┴─────────┴────────┴────────┘ # DataFrame, mixed input, create and print .name=POLARS_FMT_TABLE_FORMATTING, .value=UTF8_FULL_CONDENSED @@ -218,17 +229,18 @@ df Output shape: (5, 6) - ┌─────────┬──────┬─────┬────────────┬──────────────┬──────────────┐ - │ newname ┆ a ┆ b ┆ new_column ┆ named_vector ┆ new_column_1 │ - │ --- ┆ --- ┆ --- ┆ --- ┆ --- ┆ --- │ - │ f64 ┆ f64 ┆ str ┆ f64 ┆ f64 ┆ f64 │ - ╞═════════╪══════╪═════╪════════════╪══════════════╪══════════════╡ - │ 1.0 ┆ 5.0 ┆ a ┆ 5.0 ┆ 15.0 ┆ 5.0 │ - │ 2.0 ┆ 10.0 ┆ b ┆ 4.0 ┆ 14.0 ┆ 4.0 │ - │ 3.0 ┆ 15.0 ┆ c ┆ 3.0 ┆ 13.0 ┆ 3.0 │ - │ 4.0 ┆ 20.0 ┆ d ┆ 2.0 ┆ 12.0 ┆ 2.0 │ - │ 5.0 ┆ 25.0 ┆ e ┆ 1.0 ┆ 11.0 ┆ 0.0 │ - └─────────┴──────┴─────┴────────────┴──────────────┴──────────────┘ + ┌─────────┬──────┬─────┬─────────┬────────┬────────┐ + │ newname ┆ a ┆ b ┆ new_col ┆ named_ ┆ new_co │ + │ --- ┆ --- ┆ --- ┆ umn ┆ vector ┆ lumn_1 │ + │ f64 ┆ f64 ┆ str ┆ --- ┆ --- ┆ --- │ + │ ┆ ┆ ┆ f64 ┆ f64 ┆ f64 │ + ╞═════════╪══════╪═════╪═════════╪════════╪════════╡ + │ 1.0 ┆ 5.0 ┆ a ┆ 5.0 ┆ 15.0 ┆ 5.0 │ + │ 2.0 ┆ 10.0 ┆ b ┆ 4.0 ┆ 14.0 ┆ 4.0 │ + │ 3.0 ┆ 15.0 ┆ c ┆ 3.0 ┆ 13.0 ┆ 3.0 │ + │ 4.0 ┆ 20.0 ┆ d ┆ 2.0 ┆ 12.0 ┆ 2.0 │ + │ 5.0 ┆ 25.0 ┆ e ┆ 1.0 ┆ 11.0 ┆ 0.0 │ + └─────────┴──────┴─────┴─────────┴────────┴────────┘ # DataFrame, mixed input, create and print .name=POLARS_FMT_TABLE_FORMATTING, .value=UTF8_NO_BORDERS @@ -236,19 +248,20 @@ df Output shape: (5, 6) - newname ┆ a ┆ b ┆ new_column ┆ named_vector ┆ new_column_1 - --- ┆ --- ┆ --- ┆ --- ┆ --- ┆ --- - f64 ┆ f64 ┆ str ┆ f64 ┆ f64 ┆ f64 - ═════════╪══════╪═════╪════════════╪══════════════╪══════════════ - 1.0 ┆ 5.0 ┆ a ┆ 5.0 ┆ 15.0 ┆ 5.0 - ╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌┼╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌ - 2.0 ┆ 10.0 ┆ b ┆ 4.0 ┆ 14.0 ┆ 4.0 - ╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌┼╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌ - 3.0 ┆ 15.0 ┆ c ┆ 3.0 ┆ 13.0 ┆ 3.0 - ╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌┼╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌ - 4.0 ┆ 20.0 ┆ d ┆ 2.0 ┆ 12.0 ┆ 2.0 - ╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌┼╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌ - 5.0 ┆ 25.0 ┆ e ┆ 1.0 ┆ 11.0 ┆ 0.0 + newname ┆ a ┆ b ┆ new_col ┆ named_v ┆ new_col + --- ┆ --- ┆ --- ┆ umn ┆ ector ┆ umn_1 + f64 ┆ f64 ┆ str ┆ --- ┆ --- ┆ --- + ┆ ┆ ┆ f64 ┆ f64 ┆ f64 + ═════════╪══════╪═════╪═════════╪═════════╪═════════ + 1.0 ┆ 5.0 ┆ a ┆ 5.0 ┆ 15.0 ┆ 5.0 + ╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌┼╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌ + 2.0 ┆ 10.0 ┆ b ┆ 4.0 ┆ 14.0 ┆ 4.0 + ╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌┼╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌ + 3.0 ┆ 15.0 ┆ c ┆ 3.0 ┆ 13.0 ┆ 3.0 + ╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌┼╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌ + 4.0 ┆ 20.0 ┆ d ┆ 2.0 ┆ 12.0 ┆ 2.0 + ╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌┼╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌ + 5.0 ┆ 25.0 ┆ e ┆ 1.0 ┆ 11.0 ┆ 0.0 # DataFrame, mixed input, create and print .name=POLARS_FMT_TABLE_FORMATTING, .value=UTF8_BORDERS_ONLY @@ -256,17 +269,18 @@ df Output shape: (5, 6) - ┌─────────────────────────────────────────────────────────────────┐ - │ newname a b new_column named_vector new_column_1 │ - │ --- --- --- --- --- --- │ - │ f64 f64 str f64 f64 f64 │ - ╞═════════════════════════════════════════════════════════════════╡ - │ 1.0 5.0 a 5.0 15.0 5.0 │ - │ 2.0 10.0 b 4.0 14.0 4.0 │ - │ 3.0 15.0 c 3.0 13.0 3.0 │ - │ 4.0 20.0 d 2.0 12.0 2.0 │ - │ 5.0 25.0 e 1.0 11.0 0.0 │ - └─────────────────────────────────────────────────────────────────┘ + ┌──────────────────────────────────────────────────┐ + │ newname a b new_col named_ new_co │ + │ --- --- --- umn vector lumn_1 │ + │ f64 f64 str --- --- --- │ + │ f64 f64 f64 │ + ╞══════════════════════════════════════════════════╡ + │ 1.0 5.0 a 5.0 15.0 5.0 │ + │ 2.0 10.0 b 4.0 14.0 4.0 │ + │ 3.0 15.0 c 3.0 13.0 3.0 │ + │ 4.0 20.0 d 2.0 12.0 2.0 │ + │ 5.0 25.0 e 1.0 11.0 0.0 │ + └──────────────────────────────────────────────────┘ # DataFrame, mixed input, create and print .name=POLARS_FMT_TABLE_FORMATTING, .value=UTF8_HORIZONTAL_ONLY @@ -274,21 +288,22 @@ df Output shape: (5, 6) - ───────────────────────────────────────────────────────────────── - newname a b new_column named_vector new_column_1 - --- --- --- --- --- --- - f64 f64 str f64 f64 f64 - ═════════════════════════════════════════════════════════════════ - 1.0 5.0 a 5.0 15.0 5.0 - ───────────────────────────────────────────────────────────────── - 2.0 10.0 b 4.0 14.0 4.0 - ───────────────────────────────────────────────────────────────── - 3.0 15.0 c 3.0 13.0 3.0 - ───────────────────────────────────────────────────────────────── - 4.0 20.0 d 2.0 12.0 2.0 - ───────────────────────────────────────────────────────────────── - 5.0 25.0 e 1.0 11.0 0.0 - ───────────────────────────────────────────────────────────────── + ──────────────────────────────────────────────────── + newname a b new_col named_v new_col + --- --- --- umn ector umn_1 + f64 f64 str --- --- --- + f64 f64 f64 + ════════════════════════════════════════════════════ + 1.0 5.0 a 5.0 15.0 5.0 + ──────────────────────────────────────────────────── + 2.0 10.0 b 4.0 14.0 4.0 + ──────────────────────────────────────────────────── + 3.0 15.0 c 3.0 13.0 3.0 + ──────────────────────────────────────────────────── + 4.0 20.0 d 2.0 12.0 2.0 + ──────────────────────────────────────────────────── + 5.0 25.0 e 1.0 11.0 0.0 + ──────────────────────────────────────────────────── # DataFrame, mixed input, create and print .name=POLARS_FMT_TABLE_FORMATTING, .value=NOTHING @@ -296,14 +311,15 @@ df Output shape: (5, 6) - newname a b new_column named_vector new_column_1 - --- --- --- --- --- --- - f64 f64 str f64 f64 f64 - 1.0 5.0 a 5.0 15.0 5.0 - 2.0 10.0 b 4.0 14.0 4.0 - 3.0 15.0 c 3.0 13.0 3.0 - 4.0 20.0 d 2.0 12.0 2.0 - 5.0 25.0 e 1.0 11.0 0.0 + newname a b new_colum named_vec new_colu + --- --- --- n tor mn_1 + f64 f64 str --- --- --- + f64 f64 f64 + 1.0 5.0 a 5.0 15.0 5.0 + 2.0 10.0 b 4.0 14.0 4.0 + 3.0 15.0 c 3.0 13.0 3.0 + 4.0 20.0 d 2.0 12.0 2.0 + 5.0 25.0 e 1.0 11.0 0.0 # DataFrame, mixed input, create and print .name=POLARS_FMT_TABLE_HIDE_COLUMN_DATA_TYPES, .value=1 @@ -311,15 +327,16 @@ df Output shape: (5, 6) - ┌─────────┬──────┬───┬────────────┬──────────────┬──────────────┐ - │ newname ┆ a ┆ b ┆ new_column ┆ named_vector ┆ new_column_1 │ - ╞═════════╪══════╪═══╪════════════╪══════════════╪══════════════╡ - │ 1.0 ┆ 5.0 ┆ a ┆ 5.0 ┆ 15.0 ┆ 5.0 │ - │ 2.0 ┆ 10.0 ┆ b ┆ 4.0 ┆ 14.0 ┆ 4.0 │ - │ 3.0 ┆ 15.0 ┆ c ┆ 3.0 ┆ 13.0 ┆ 3.0 │ - │ 4.0 ┆ 20.0 ┆ d ┆ 2.0 ┆ 12.0 ┆ 2.0 │ - │ 5.0 ┆ 25.0 ┆ e ┆ 1.0 ┆ 11.0 ┆ 0.0 │ - └─────────┴──────┴───┴────────────┴──────────────┴──────────────┘ + ┌─────────┬──────┬───┬─────────┬─────────┬─────────┐ + │ newname ┆ a ┆ b ┆ new_col ┆ named_v ┆ new_col │ + │ ┆ ┆ ┆ umn ┆ ector ┆ umn_1 │ + ╞═════════╪══════╪═══╪═════════╪═════════╪═════════╡ + │ 1.0 ┆ 5.0 ┆ a ┆ 5.0 ┆ 15.0 ┆ 5.0 │ + │ 2.0 ┆ 10.0 ┆ b ┆ 4.0 ┆ 14.0 ┆ 4.0 │ + │ 3.0 ┆ 15.0 ┆ c ┆ 3.0 ┆ 13.0 ┆ 3.0 │ + │ 4.0 ┆ 20.0 ┆ d ┆ 2.0 ┆ 12.0 ┆ 2.0 │ + │ 5.0 ┆ 25.0 ┆ e ┆ 1.0 ┆ 11.0 ┆ 0.0 │ + └─────────┴──────┴───┴─────────┴─────────┴─────────┘ # DataFrame, mixed input, create and print .name=POLARS_FMT_TABLE_HIDE_COLUMN_NAMES, .value=1 @@ -343,33 +360,35 @@ df Output shape: (5, 6) - ┌─────────┬──────┬─────┬────────────┬──────────────┬──────────────┐ - │ newname ┆ a ┆ b ┆ new_column ┆ named_vector ┆ new_column_1 │ - │ f64 ┆ f64 ┆ str ┆ f64 ┆ f64 ┆ f64 │ - ╞═════════╪══════╪═════╪════════════╪══════════════╪══════════════╡ - │ 1.0 ┆ 5.0 ┆ a ┆ 5.0 ┆ 15.0 ┆ 5.0 │ - │ 2.0 ┆ 10.0 ┆ b ┆ 4.0 ┆ 14.0 ┆ 4.0 │ - │ 3.0 ┆ 15.0 ┆ c ┆ 3.0 ┆ 13.0 ┆ 3.0 │ - │ 4.0 ┆ 20.0 ┆ d ┆ 2.0 ┆ 12.0 ┆ 2.0 │ - │ 5.0 ┆ 25.0 ┆ e ┆ 1.0 ┆ 11.0 ┆ 0.0 │ - └─────────┴──────┴─────┴────────────┴──────────────┴──────────────┘ + ┌─────────┬──────┬─────┬─────────┬────────┬────────┐ + │ newname ┆ a ┆ b ┆ new_col ┆ named_ ┆ new_co │ + │ f64 ┆ f64 ┆ str ┆ umn ┆ vector ┆ lumn_1 │ + │ ┆ ┆ ┆ f64 ┆ f64 ┆ f64 │ + ╞═════════╪══════╪═════╪═════════╪════════╪════════╡ + │ 1.0 ┆ 5.0 ┆ a ┆ 5.0 ┆ 15.0 ┆ 5.0 │ + │ 2.0 ┆ 10.0 ┆ b ┆ 4.0 ┆ 14.0 ┆ 4.0 │ + │ 3.0 ┆ 15.0 ┆ c ┆ 3.0 ┆ 13.0 ┆ 3.0 │ + │ 4.0 ┆ 20.0 ┆ d ┆ 2.0 ┆ 12.0 ┆ 2.0 │ + │ 5.0 ┆ 25.0 ┆ e ┆ 1.0 ┆ 11.0 ┆ 0.0 │ + └─────────┴──────┴─────┴─────────┴────────┴────────┘ # DataFrame, mixed input, create and print .name=POLARS_FMT_TABLE_HIDE_DATAFRAME_SHAPE_INFORMATION, .value=1 Code df Output - ┌─────────┬──────┬─────┬────────────┬──────────────┬──────────────┐ - │ newname ┆ a ┆ b ┆ new_column ┆ named_vector ┆ new_column_1 │ - │ --- ┆ --- ┆ --- ┆ --- ┆ --- ┆ --- │ - │ f64 ┆ f64 ┆ str ┆ f64 ┆ f64 ┆ f64 │ - ╞═════════╪══════╪═════╪════════════╪══════════════╪══════════════╡ - │ 1.0 ┆ 5.0 ┆ a ┆ 5.0 ┆ 15.0 ┆ 5.0 │ - │ 2.0 ┆ 10.0 ┆ b ┆ 4.0 ┆ 14.0 ┆ 4.0 │ - │ 3.0 ┆ 15.0 ┆ c ┆ 3.0 ┆ 13.0 ┆ 3.0 │ - │ 4.0 ┆ 20.0 ┆ d ┆ 2.0 ┆ 12.0 ┆ 2.0 │ - │ 5.0 ┆ 25.0 ┆ e ┆ 1.0 ┆ 11.0 ┆ 0.0 │ - └─────────┴──────┴─────┴────────────┴──────────────┴──────────────┘ + ┌─────────┬──────┬─────┬─────────┬────────┬────────┐ + │ newname ┆ a ┆ b ┆ new_col ┆ named_ ┆ new_co │ + │ --- ┆ --- ┆ --- ┆ umn ┆ vector ┆ lumn_1 │ + │ f64 ┆ f64 ┆ str ┆ --- ┆ --- ┆ --- │ + │ ┆ ┆ ┆ f64 ┆ f64 ┆ f64 │ + ╞═════════╪══════╪═════╪═════════╪════════╪════════╡ + │ 1.0 ┆ 5.0 ┆ a ┆ 5.0 ┆ 15.0 ┆ 5.0 │ + │ 2.0 ┆ 10.0 ┆ b ┆ 4.0 ┆ 14.0 ┆ 4.0 │ + │ 3.0 ┆ 15.0 ┆ c ┆ 3.0 ┆ 13.0 ┆ 3.0 │ + │ 4.0 ┆ 20.0 ┆ d ┆ 2.0 ┆ 12.0 ┆ 2.0 │ + │ 5.0 ┆ 25.0 ┆ e ┆ 1.0 ┆ 11.0 ┆ 0.0 │ + └─────────┴──────┴─────┴─────────┴────────┴────────┘ # DataFrame, mixed input, create and print .name=POLARS_FMT_MAX_ROWS, .value=2 @@ -377,15 +396,16 @@ df Output shape: (5, 6) - ┌─────────┬──────┬─────┬────────────┬──────────────┬──────────────┐ - │ newname ┆ a ┆ b ┆ new_column ┆ named_vector ┆ new_column_1 │ - │ --- ┆ --- ┆ --- ┆ --- ┆ --- ┆ --- │ - │ f64 ┆ f64 ┆ str ┆ f64 ┆ f64 ┆ f64 │ - ╞═════════╪══════╪═════╪════════════╪══════════════╪══════════════╡ - │ 1.0 ┆ 5.0 ┆ a ┆ 5.0 ┆ 15.0 ┆ 5.0 │ - │ … ┆ … ┆ … ┆ … ┆ … ┆ … │ - │ 5.0 ┆ 25.0 ┆ e ┆ 1.0 ┆ 11.0 ┆ 0.0 │ - └─────────┴──────┴─────┴────────────┴──────────────┴──────────────┘ + ┌─────────┬──────┬─────┬─────────┬────────┬────────┐ + │ newname ┆ a ┆ b ┆ new_col ┆ named_ ┆ new_co │ + │ --- ┆ --- ┆ --- ┆ umn ┆ vector ┆ lumn_1 │ + │ f64 ┆ f64 ┆ str ┆ --- ┆ --- ┆ --- │ + │ ┆ ┆ ┆ f64 ┆ f64 ┆ f64 │ + ╞═════════╪══════╪═════╪═════════╪════════╪════════╡ + │ 1.0 ┆ 5.0 ┆ a ┆ 5.0 ┆ 15.0 ┆ 5.0 │ + │ … ┆ … ┆ … ┆ … ┆ … ┆ … │ + │ 5.0 ┆ 25.0 ┆ e ┆ 1.0 ┆ 11.0 ┆ 0.0 │ + └─────────┴──────┴─────┴─────────┴────────┴────────┘ # describe @@ -415,21 +435,38 @@ pl$DataFrame(mtcars)$describe() Output shape: (9, 12) - ┌────────────┬───────────┬──────────┬────────────┬───┬──────────┬──────────┬──────────┬────────┐ - │ statistic ┆ mpg ┆ cyl ┆ disp ┆ … ┆ vs ┆ am ┆ gear ┆ carb │ - │ --- ┆ --- ┆ --- ┆ --- ┆ ┆ --- ┆ --- ┆ --- ┆ --- │ - │ str ┆ f64 ┆ f64 ┆ f64 ┆ ┆ f64 ┆ f64 ┆ f64 ┆ f64 │ - ╞════════════╪═══════════╪══════════╪════════════╪═══╪══════════╪══════════╪══════════╪════════╡ - │ count ┆ 32.0 ┆ 32.0 ┆ 32.0 ┆ … ┆ 32.0 ┆ 32.0 ┆ 32.0 ┆ 32.0 │ - │ null_count ┆ 0.0 ┆ 0.0 ┆ 0.0 ┆ … ┆ 0.0 ┆ 0.0 ┆ 0.0 ┆ 0.0 │ - │ mean ┆ 20.090625 ┆ 6.1875 ┆ 230.721875 ┆ … ┆ 0.4375 ┆ 0.40625 ┆ 3.6875 ┆ 2.8125 │ - │ std ┆ 6.026948 ┆ 1.785922 ┆ 123.938694 ┆ … ┆ 0.504016 ┆ 0.498991 ┆ 0.737804 ┆ 1.6152 │ - │ min ┆ 10.4 ┆ 4.0 ┆ 71.1 ┆ … ┆ 0.0 ┆ 0.0 ┆ 3.0 ┆ 1.0 │ - │ 25% ┆ 15.5 ┆ 4.0 ┆ 121.0 ┆ … ┆ 0.0 ┆ 0.0 ┆ 3.0 ┆ 2.0 │ - │ 50% ┆ 19.2 ┆ 6.0 ┆ 225.0 ┆ … ┆ 0.0 ┆ 0.0 ┆ 4.0 ┆ 2.0 │ - │ 75% ┆ 22.8 ┆ 8.0 ┆ 318.0 ┆ … ┆ 1.0 ┆ 1.0 ┆ 4.0 ┆ 4.0 │ - │ max ┆ 33.9 ┆ 8.0 ┆ 472.0 ┆ … ┆ 1.0 ┆ 1.0 ┆ 5.0 ┆ 8.0 │ - └────────────┴───────────┴──────────┴────────────┴───┴──────────┴──────────┴──────────┴────────┘ + ┌─────┬─────┬─────┬─────┬───┬─────┬─────┬─────┬─────┐ + │ sta ┆ mpg ┆ cyl ┆ dis ┆ … ┆ vs ┆ am ┆ gea ┆ car │ + │ tis ┆ --- ┆ --- ┆ p ┆ ┆ --- ┆ --- ┆ r ┆ b │ + │ tic ┆ f64 ┆ f64 ┆ --- ┆ ┆ f64 ┆ f64 ┆ --- ┆ --- │ + │ --- ┆ ┆ ┆ f64 ┆ ┆ ┆ ┆ f64 ┆ f64 │ + │ str ┆ ┆ ┆ ┆ ┆ ┆ ┆ ┆ │ + ╞═════╪═════╪═════╪═════╪═══╪═════╪═════╪═════╪═════╡ + │ cou ┆ 32. ┆ 32. ┆ 32. ┆ … ┆ 32. ┆ 32. ┆ 32. ┆ 32. │ + │ nt ┆ 0 ┆ 0 ┆ 0 ┆ ┆ 0 ┆ 0 ┆ 0 ┆ 0 │ + │ nul ┆ 0.0 ┆ 0.0 ┆ 0.0 ┆ … ┆ 0.0 ┆ 0.0 ┆ 0.0 ┆ 0.0 │ + │ l_c ┆ ┆ ┆ ┆ ┆ ┆ ┆ ┆ │ + │ oun ┆ ┆ ┆ ┆ ┆ ┆ ┆ ┆ │ + │ t ┆ ┆ ┆ ┆ ┆ ┆ ┆ ┆ │ + │ mea ┆ 20. ┆ 6.1 ┆ 230 ┆ … ┆ 0.4 ┆ 0.4 ┆ 3.6 ┆ 2.8 │ + │ n ┆ 090 ┆ 875 ┆ .72 ┆ ┆ 375 ┆ 062 ┆ 875 ┆ 125 │ + │ ┆ 625 ┆ ┆ 187 ┆ ┆ ┆ 5 ┆ ┆ │ + │ ┆ ┆ ┆ 5 ┆ ┆ ┆ ┆ ┆ │ + │ std ┆ 6.0 ┆ 1.7 ┆ 123 ┆ … ┆ 0.5 ┆ 0.4 ┆ 0.7 ┆ 1.6 │ + │ ┆ 269 ┆ 859 ┆ .93 ┆ ┆ 040 ┆ 989 ┆ 378 ┆ 152 │ + │ ┆ 48 ┆ 22 ┆ 869 ┆ ┆ 16 ┆ 91 ┆ 04 ┆ │ + │ ┆ ┆ ┆ 4 ┆ ┆ ┆ ┆ ┆ │ + │ min ┆ 10. ┆ 4.0 ┆ 71. ┆ … ┆ 0.0 ┆ 0.0 ┆ 3.0 ┆ 1.0 │ + │ ┆ 4 ┆ ┆ 1 ┆ ┆ ┆ ┆ ┆ │ + │ 25% ┆ 15. ┆ 4.0 ┆ 121 ┆ … ┆ 0.0 ┆ 0.0 ┆ 3.0 ┆ 2.0 │ + │ ┆ 5 ┆ ┆ .0 ┆ ┆ ┆ ┆ ┆ │ + │ 50% ┆ 19. ┆ 6.0 ┆ 225 ┆ … ┆ 0.0 ┆ 0.0 ┆ 4.0 ┆ 2.0 │ + │ ┆ 2 ┆ ┆ .0 ┆ ┆ ┆ ┆ ┆ │ + │ 75% ┆ 22. ┆ 8.0 ┆ 318 ┆ … ┆ 1.0 ┆ 1.0 ┆ 4.0 ┆ 4.0 │ + │ ┆ 8 ┆ ┆ .0 ┆ ┆ ┆ ┆ ┆ │ + │ max ┆ 33. ┆ 8.0 ┆ 472 ┆ … ┆ 1.0 ┆ 1.0 ┆ 5.0 ┆ 8.0 │ + │ ┆ 9 ┆ ┆ .0 ┆ ┆ ┆ ┆ ┆ │ + └─────┴─────┴─────┴─────┴───┴─────┴─────┴─────┴─────┘ --- @@ -437,21 +474,39 @@ pl$DataFrame(mtcars)$describe(interpolation = "linear") Output shape: (9, 12) - ┌────────────┬───────────┬──────────┬────────────┬───┬──────────┬──────────┬──────────┬────────┐ - │ statistic ┆ mpg ┆ cyl ┆ disp ┆ … ┆ vs ┆ am ┆ gear ┆ carb │ - │ --- ┆ --- ┆ --- ┆ --- ┆ ┆ --- ┆ --- ┆ --- ┆ --- │ - │ str ┆ f64 ┆ f64 ┆ f64 ┆ ┆ f64 ┆ f64 ┆ f64 ┆ f64 │ - ╞════════════╪═══════════╪══════════╪════════════╪═══╪══════════╪══════════╪══════════╪════════╡ - │ count ┆ 32.0 ┆ 32.0 ┆ 32.0 ┆ … ┆ 32.0 ┆ 32.0 ┆ 32.0 ┆ 32.0 │ - │ null_count ┆ 0.0 ┆ 0.0 ┆ 0.0 ┆ … ┆ 0.0 ┆ 0.0 ┆ 0.0 ┆ 0.0 │ - │ mean ┆ 20.090625 ┆ 6.1875 ┆ 230.721875 ┆ … ┆ 0.4375 ┆ 0.40625 ┆ 3.6875 ┆ 2.8125 │ - │ std ┆ 6.026948 ┆ 1.785922 ┆ 123.938694 ┆ … ┆ 0.504016 ┆ 0.498991 ┆ 0.737804 ┆ 1.6152 │ - │ min ┆ 10.4 ┆ 4.0 ┆ 71.1 ┆ … ┆ 0.0 ┆ 0.0 ┆ 3.0 ┆ 1.0 │ - │ 25% ┆ 15.425 ┆ 4.0 ┆ 120.825 ┆ … ┆ 0.0 ┆ 0.0 ┆ 3.0 ┆ 2.0 │ - │ 50% ┆ 19.2 ┆ 6.0 ┆ 196.3 ┆ … ┆ 0.0 ┆ 0.0 ┆ 4.0 ┆ 2.0 │ - │ 75% ┆ 22.8 ┆ 8.0 ┆ 326.0 ┆ … ┆ 1.0 ┆ 1.0 ┆ 4.0 ┆ 4.0 │ - │ max ┆ 33.9 ┆ 8.0 ┆ 472.0 ┆ … ┆ 1.0 ┆ 1.0 ┆ 5.0 ┆ 8.0 │ - └────────────┴───────────┴──────────┴────────────┴───┴──────────┴──────────┴──────────┴────────┘ + ┌─────┬─────┬─────┬─────┬───┬─────┬─────┬─────┬─────┐ + │ sta ┆ mpg ┆ cyl ┆ dis ┆ … ┆ vs ┆ am ┆ gea ┆ car │ + │ tis ┆ --- ┆ --- ┆ p ┆ ┆ --- ┆ --- ┆ r ┆ b │ + │ tic ┆ f64 ┆ f64 ┆ --- ┆ ┆ f64 ┆ f64 ┆ --- ┆ --- │ + │ --- ┆ ┆ ┆ f64 ┆ ┆ ┆ ┆ f64 ┆ f64 │ + │ str ┆ ┆ ┆ ┆ ┆ ┆ ┆ ┆ │ + ╞═════╪═════╪═════╪═════╪═══╪═════╪═════╪═════╪═════╡ + │ cou ┆ 32. ┆ 32. ┆ 32. ┆ … ┆ 32. ┆ 32. ┆ 32. ┆ 32. │ + │ nt ┆ 0 ┆ 0 ┆ 0 ┆ ┆ 0 ┆ 0 ┆ 0 ┆ 0 │ + │ nul ┆ 0.0 ┆ 0.0 ┆ 0.0 ┆ … ┆ 0.0 ┆ 0.0 ┆ 0.0 ┆ 0.0 │ + │ l_c ┆ ┆ ┆ ┆ ┆ ┆ ┆ ┆ │ + │ oun ┆ ┆ ┆ ┆ ┆ ┆ ┆ ┆ │ + │ t ┆ ┆ ┆ ┆ ┆ ┆ ┆ ┆ │ + │ mea ┆ 20. ┆ 6.1 ┆ 230 ┆ … ┆ 0.4 ┆ 0.4 ┆ 3.6 ┆ 2.8 │ + │ n ┆ 090 ┆ 875 ┆ .72 ┆ ┆ 375 ┆ 062 ┆ 875 ┆ 125 │ + │ ┆ 625 ┆ ┆ 187 ┆ ┆ ┆ 5 ┆ ┆ │ + │ ┆ ┆ ┆ 5 ┆ ┆ ┆ ┆ ┆ │ + │ std ┆ 6.0 ┆ 1.7 ┆ 123 ┆ … ┆ 0.5 ┆ 0.4 ┆ 0.7 ┆ 1.6 │ + │ ┆ 269 ┆ 859 ┆ .93 ┆ ┆ 040 ┆ 989 ┆ 378 ┆ 152 │ + │ ┆ 48 ┆ 22 ┆ 869 ┆ ┆ 16 ┆ 91 ┆ 04 ┆ │ + │ ┆ ┆ ┆ 4 ┆ ┆ ┆ ┆ ┆ │ + │ min ┆ 10. ┆ 4.0 ┆ 71. ┆ … ┆ 0.0 ┆ 0.0 ┆ 3.0 ┆ 1.0 │ + │ ┆ 4 ┆ ┆ 1 ┆ ┆ ┆ ┆ ┆ │ + │ 25% ┆ 15. ┆ 4.0 ┆ 120 ┆ … ┆ 0.0 ┆ 0.0 ┆ 3.0 ┆ 2.0 │ + │ ┆ 425 ┆ ┆ .82 ┆ ┆ ┆ ┆ ┆ │ + │ ┆ ┆ ┆ 5 ┆ ┆ ┆ ┆ ┆ │ + │ 50% ┆ 19. ┆ 6.0 ┆ 196 ┆ … ┆ 0.0 ┆ 0.0 ┆ 4.0 ┆ 2.0 │ + │ ┆ 2 ┆ ┆ .3 ┆ ┆ ┆ ┆ ┆ │ + │ 75% ┆ 22. ┆ 8.0 ┆ 326 ┆ … ┆ 1.0 ┆ 1.0 ┆ 4.0 ┆ 4.0 │ + │ ┆ 8 ┆ ┆ .0 ┆ ┆ ┆ ┆ ┆ │ + │ max ┆ 33. ┆ 8.0 ┆ 472 ┆ … ┆ 1.0 ┆ 1.0 ┆ 5.0 ┆ 8.0 │ + │ ┆ 9 ┆ ┆ .0 ┆ ┆ ┆ ┆ ┆ │ + └─────┴─────┴─────┴─────┴───┴─────┴─────┴─────┴─────┘ --- diff --git a/tests/testthat/test-datatype.R b/tests/testthat/test-datatype.R index bf2e01e00..11aac3d15 100644 --- a/tests/testthat/test-datatype.R +++ b/tests/testthat/test-datatype.R @@ -224,18 +224,17 @@ test_that("contains_* functions for datatype work", { }) test_that("Enum", { - # Generate 100 random data frames with random - # orders for levels. They should always match - for (i in 1:100) { - expected_levels = sample(letters, length(letters)) - expected_values = sample(letters, length(letters)) - expect_identical( - as_polars_series(expected_values)$ - cast(pl$Enum(expected_levels))$ - to_r(), - factor(expected_values, levels = expected_levels) - ) - } + quickcheck::for_all( + property = function(factors) { + expect_identical( + as_polars_series(as.character(factors))$ + cast(pl$Enum(levels(factors)))$ + to_r(), + factors + ) + }, + factors = quickcheck::factor_() + ) expect_grepl_error(pl$Enum(), "missing") expect_grepl_error(pl$Enum(1), "invalid series dtype")