Gmousse / dataframe-js

No Maintenance Intended
https://gmousse.gitbooks.io/dataframe-js/
MIT License
460 stars 38 forks source link

[QUESTION] Why does the aggregate function drops all columns ? #124

Closed RafaelQuirino closed 2 years ago

RafaelQuirino commented 3 years ago

Aggregation dropping columns I am trying to understand this GroupedDataFrame, its doc is empty. Why when i do a groupBy and then an aggregation all other columns besides the ones given to the groupBy function gets dropped ? I want to perform aggregations and keep all the columns in the dataframe i called groupBy. Is it possible ?

ecolangelo commented 2 years ago

I think the problem is that if you groupBy a specific column, there's no way you can tell which value the other columns must have unless we change the aggregate API. I have a same problem, imagine a dataframe like |name| height | weight| age|

and you do df.groupBy('name').aggregate(group=>group.stat.sum('age')) what would you do with height and weight? a sum? a mean?

RafaelQuirino commented 2 years ago

I was quite confused at the time i made this rather stupid question. I apologize...