danfojs icon indicating copy to clipboard operation
danfojs copied to clipboard

[Question] How to get first and last data using group by

Open tarikhagustia opened this issue 3 years ago • 2 comments
trafficstars

hi i'm looking for this solution https://stackoverflow.com/questions/62373692/how-do-you-convert-1-minute-open-high-low-close-data-to-another-timeframefx-5 using this library. but i can't find first and last data grouping.

tarikhagustia avatar Nov 16 '22 00:11 tarikhagustia

@tarikhagustia

for any groupby variable you should be able to do this

let grpby = df.groupby("column")
grpby.first() // first of the grouping
grpby.last() // last of the grouping

steveoni avatar Nov 22 '22 12:11 steveoni

@tarikhagustia

for any groupby variable you should be able to do this

let grpby = df.groupby("column")
grpby.first() // first of the grouping
grpby.last() // last of the grouping

but how to use in .agg function?

tarikhagustia avatar Nov 22 '22 12:11 tarikhagustia