Pandas rows aggregation

I have a small Dataframe of 5 rows like in a GroupBy result and I want to collapse it into one single row, where each column type is a list of all the values present in the 5 rows.

Is there a cheaper way than using the Pandas function .agg and passing a dictionary with each column name assigned to list to make it?



Read more here: https://stackoverflow.com/questions/66266232/pandas-rows-aggregation

Content Attribution

This content was originally published by Guido at Recent Questions - Stack Overflow, and is syndicated here via their RSS feed. You can read the original post over there.

%d bloggers like this: