Ungroup a DynamicGroupBy object
Description
Revert the $group_by_dynamic()
operation. Doing
<DataFrame>$group_by_dynamic(…)$ungroup()
returns the original DataFrame
.
Usage
<DynamicGroupBy>$ungroup()
Value
DataFrame
Examples
library("polars")
df = pl$DataFrame(
time = pl$datetime_range(
start = strptime("2021-12-16 00:00:00", format = "%Y-%m-%d %H:%M:%S", tz = "UTC"),
end = strptime("2021-12-16 03:00:00", format = "%Y-%m-%d %H:%M:%S", tz = "UTC"),
interval = "30m"
),
n = 0:6
)
df
#> shape: (7, 2)
#> ┌─────────────────────────┬─────┐
#> │ time ┆ n │
#> │ --- ┆ --- │
#> │ datetime[ms, UTC] ┆ i32 │
#> ╞═════════════════════════╪═════╡
#> │ 2021-12-16 00:00:00 UTC ┆ 0 │
#> │ 2021-12-16 00:30:00 UTC ┆ 1 │
#> │ 2021-12-16 01:00:00 UTC ┆ 2 │
#> │ 2021-12-16 01:30:00 UTC ┆ 3 │
#> │ 2021-12-16 02:00:00 UTC ┆ 4 │
#> │ 2021-12-16 02:30:00 UTC ┆ 5 │
#> │ 2021-12-16 03:00:00 UTC ┆ 6 │
#> └─────────────────────────┴─────┘
#> shape: (7, 2)
#> ┌─────────────────────────┬─────┐
#> │ time ┆ n │
#> │ --- ┆ --- │
#> │ datetime[ms, UTC] ┆ i32 │
#> ╞═════════════════════════╪═════╡
#> │ 2021-12-16 00:00:00 UTC ┆ 0 │
#> │ 2021-12-16 00:30:00 UTC ┆ 1 │
#> │ 2021-12-16 01:00:00 UTC ┆ 2 │
#> │ 2021-12-16 01:30:00 UTC ┆ 3 │
#> │ 2021-12-16 02:00:00 UTC ┆ 4 │
#> │ 2021-12-16 02:30:00 UTC ┆ 5 │
#> │ 2021-12-16 03:00:00 UTC ┆ 6 │
#> └─────────────────────────┴─────┘