Код: Выделить всё
import polars as pl
df = pl.from_repr("""
┌─────┬──────┬──────┬──────┬──────┐
│ id ┆ hcc1 ┆ hcc2 ┆ hcc5 ┆ hcc8 │
│ --- ┆ --- ┆ --- ┆ --- ┆ --- │
│ i64 ┆ i64 ┆ i64 ┆ i64 ┆ i64 │
╞═════╪══════╪══════╪══════╪══════╡
│ 1 ┆ 0 ┆ 0 ┆ 0 ┆ 1 │
│ 2 ┆ 1 ┆ 0 ┆ 1 ┆ 0 │
│ 3 ┆ 1 ┆ 1 ┆ 1 ┆ 0 │
└─────┴──────┴──────┴──────┴──────┘
""")
Код: Выделить всё
shape: (3, 2)
┌─────┬────────┐
│ id ┆ hccall │
│ --- ┆ --- │
│ i64 ┆ str │
╞═════╪════════╡
│ 1 ┆ 8 │
│ 2 ┆ 1,5 │
│ 3 ┆ 1,2,5 │
└─────┴────────┘
Подробнее здесь: https://stackoverflow.com/questions/769 ... lumn-names
Мобильная версия