Код: Выделить всё
>>> df = pl.DataFrame(dict(j=numpy.random.randint(10, 99, 20)))
>>> df
shape: (20, 1)
┌─────┐
│ j │
│ --- │
│ i64 │
╞═════╡
│ 47 │
│ 22 │
│ 82 │
│ 19 │
│ … │
│ 28 │
│ 94 │
│ 21 │
│ 38 │
└─────┘
>>> df.get_column('j').hist([10, 20, 30, 50])
shape: (5, 3)
┌─────────────┬──────────────┬─────────┐
│ break_point ┆ category ┆ j_count │
│ --- ┆ --- ┆ --- │
│ f64 ┆ cat ┆ u32 │
╞═════════════╪══════════════╪═════════╡
│ 10.0 ┆ (-inf, 10.0] ┆ 0 │
│ 20.0 ┆ (10.0, 20.0] ┆ 4 │
│ 30.0 ┆ (20.0, 30.0] ┆ 5 │
│ 50.0 ┆ (30.0, 50.0] ┆ 3 │
│ inf ┆ (50.0, inf] ┆ 8 │
└─────────────┴──────────────┴─────────┘
Подробнее здесь: https://stackoverflow.com/questions/764 ... -hist-in-p