Skip to main content

chat1

    next_is_wide = wide_unwide.sort(by='timestamp').with_columns(
        next_wide = pl.col("is_wide").shift(-1),
        next_unwide = pl.col("is_unwide").shift(-1),
    ).filter(
        (pl.col("is_wide") == 0) & (pl.col("next_wide") == 1)
    )

    next_is_unwide = wide_unwide.sort(by='timestamp').with_columns(
        next_wide = pl.col("is_wide").shift(-1),
        next_unwide = pl.col("is_unwide").shift(-1),
    ).filter(
        (pl.col("is_wide") == 1) & (pl.col("next_unwide") == 1)
    )