Closed Leo-Ji2020 closed 3 years ago
This will actually have a similar solution to https://github.com/vaexio/vaex/issues/1448, so I recommend you follow that issue in addition to this one.
Indeed, like @kmcentush said.
Anyway here is a belated example
import vaex
df = vaex.example()
g = df.groupby('id')
dfs = []
for _, df_tmp in g:
dfs.append(df_tmp[:1])
df2 = vaex.concat(dfs)
df2 = df2.trim() # this will make things faster.
I have a request: After groupby a vaex dataframe, how can I get the first row of each group to build a new vaex dataframe? for example: