for example, I have a
dataframe with these 2 columns
a = [1,1,1,1,1,1,1,2,2,2,2,2,2,2,3,3,3,3,3,3,3] b = [1,2,3,4,5,6,7,8,9,0,1,2,3,4,5,6,7,8,9,0,1]
I am expecting filtered dataframe:
Without using the
groupby function (because it is take too long time with a very large
dataframe, it just not usable), how do I filter with the last 3 items from each group in col.