79598614

Date: 2025-04-29 14:32:16
Score: 1
Natty:
Report link

Make a copy of the grouping column and group by that column. The duplicate column disappears in the group by. Perhaps not pretty, but effective.

df['col1_for_groupby'] = df['col1']
df = df.groupby(["col1_for_groupby"], as_index=False).fillna(method="ffill")
Reasons:
  • Low length (0.5):
  • Has code block (-0.5):
  • Low reputation (1):
Posted by: hickemack