например, у меня есть генератор списков, который запускает функцию для выражения x
Код: Выделить всё
final = [
df.select(
threshold_rank(λ=lambda_df.select(series + '_lambda').item(),
x=pl.col(series))
.alias(series + '_rank')
).collect()
for series in fields
]
Код: Выделить всё
def threshold_rank(λ, x):
e = 2.718281828459045
t = 22.108576145 # t is the threshold value
k = 1 # k is a scaling factor that determines how rapidly the rankings increase above the threshold
if x
Подробнее здесь: [url]https://stackoverflow.com/questions/75796307/how-do-you-use-conditionals-with-polars-lazyframes[/url]