Question:
In the example under the section Operations per group the author writes:The resulting frame is :
In the example he sorted ‘Speed'(My best guess), therefore speed should be continuous, but isn’t due to the last row with the value 95. On the other hand he just sorted the group ‘Type 1’, so how does the column get added back to the Dataframe?
For aggregations it’s clear because:
The results of the aggregation are projected back to the original rows. but what about operations within a group?
What am i missing? Is it just sorting the rows of each group? For example:
if i have Type 1 == ‘Water’ in row 1,3 and 7 it will just swap out these positions?
Answer:
What am i missing? Is it just sorting the rows of each group? For example:
if i have Type 1 == ‘Water’ in row 1,3 and 7 it will just swap out these positions?
Yes! 🙂
So the operations work within a group no matter at which row location the group elements are. The window functions will find them.
If you have better answer, please add a comment about this, thank you!