I'm not sure if "explode" is the right term here. I have a DataFrame with columns event_id, num_steps, and avg_time.
I'd like to end up with a DataFrame where, for each event_id, there are num_steps rows with each row counting from 0 to num_steps.
event_id, num_steps, avg_time
1, 3, 5
Should become:
event_id, num_steps, avg_time
1, 0, 5
1, 1, 5
1, 2, 5
Currently I'm iterating over the dataframe and creating this manually, but I'm wondering if there is any way to do this directly within Pandas to increase processing time?
Thanks!