Код: Выделить всё
df = (
df
.with_columns_seq([
pl.col('sentiment').cast(pl.UInt8),
pl.col('review').map_elements(lambda x: BeautifulSoup(x).get_text()),
pl.col('review').str.replace(r"[^a-zA-Z0-9]", " "),
pl.col('review').str.to_lowercase(),
# pl.col('review').str.split_by(' ')
])
)
df.collect().head()
Код: Выделить всё
ComputeError: the name: 'review' passed to `LazyFrame.with_columns` is duplicate
It's possible that multiple expressions are returning the same default column name. If this is the case, try renaming the columns with `.alias("new_name")` to avoid duplicate column names.
Подробнее здесь: https://stackoverflow.com/questions/781 ... n-a-single
Мобильная версия