Пример DataFrame:
Код: Выделить всё
import polars as pl
df = pl.DataFrame({
"Description": [
"Would never order again.",
"I'm not sure it gives me any type of glow and",
"Goes on smoothly a bit sticky and color is glow",
"Preferisco altri prodotti della stessa marca.",
"The moisturizing advertised is non-existent."
]
})
Код: Выделить всё
pl.from_pandas(
df.to_pandas().Description.str.split(expand=True)
.stack()
.value_counts()
.reset_index()
)
Код: Выделить всё
shape: (33, 2)
┌───────────────┬───────┐
│ index ┆ count │
│ --- ┆ --- │
│ str ┆ i64 │
╞═══════════════╪═══════╡
│ and ┆ 2 │
│ glow ┆ 2 │
│ is ┆ 2 │
│ Would ┆ 1 │
│ altri ┆ 1 │
│ … ┆ … │
│ not ┆ 1 │
│ I'm ┆ 1 │
│ again. ┆ 1 │
│ order ┆ 1 │
│ non-existent. ┆ 1 │
└───────────────┴───────┘
Подробнее здесь: https://stackoverflow.com/questions/710 ... ing-column