79296430

Date: 2024-12-20 07:21:37
Score: 1
Natty:
Report link

Now I use group_by and slice to complete this.

station_len = len(self.x['basin_id'].unique())
x_truncated = (self.x.group_by('basin_id', maintain_order=True).agg(pl.all().slice(0, len(self.x) // station_len)).
                       explode(pl.exclude("basin_id"))
Reasons:
  • Low length (0.5):
  • Has code block (-0.5):
  • Self-answer (0.5):
  • Low reputation (0.5):
Posted by: forestbat