Скажем, у меня есть собственная функция Python
Код: Выделить всё
def my_complicated_function(row):
# ...
return value1, value2, value3
Код: Выделить всё
df = df.with_columns(
pl.struct(pl.all())
.map_elements(my_complicated_function, return_dtype=pl.Int64)
.alias("column1", "column2", "column3")
)
Подробнее здесь: https://stackoverflow.com/questions/792 ... p-elements
Мобильная версия