Reputation: 11
I have a round per round database of online players. I have to set an alert for players who have lost 1000 or more within 24 hours. My code looks like that:
result = (
d.with_columns(rolling_sum=pl.col('netloss').rolling_sum_by('created', window_size='24h').over('player_id'))
)
result = (
result.with_columns(
signal=pl.when(pl.col('rolling_sum')<=-1000).then(1).otherwise(0)
)
)
This works well, but my issue is that when a players gets a signal==1
he cannot get another one for 35 days. My data is quit big (300M lines, 22Gb) so I want to avoid using for loops. Is there any solution to set a sort of cooldown period of 35 days after a signal ?
Upvotes: 0
Views: 50