src/services/censoring.py
BeforeProposed
+1−1
44
55
66def apply(frame, through):
7 complete = period_end(F.col('cohort'), F.col('week')) < through
7 complete = period_end(F.col('cohort'), F.col('week')) <= through
88 return (frame.withColumn('eligible', F.when(complete, F.col('cohortSize')).otherwise(F.lit(0)))
99 .withColumn('retentionBps', F.when(complete, basis_points(F.col('active'), F.col('cohortSize'))))
1010 .withColumn('active', F.when(complete, F.col('active')))