I have this dataframe:
person_code type growth size ...
0 . 231 32 0.54 32
1 . 233 43 0.12 333
2 . 432 32 0.44 21
3 . 431 56 0.32 23
4 . 654 89 0.12 89
5 . 764 32 0.20 211
6 . 434 32 0.82 90
...
(This dataframe is pretty big, I made a simplification here)
I want to create one dataframe for each type with the 3 persons with higher "growth", ordered by it. I want to be able to call it by type. In this case, let's use the type 32, so the output df should look something like this:
person_code type growth size ...
6 . 434 32 0.82 90
0 . 231 32 0.54 32
2 . 432 32 0.44 21
...
I understand that it would be something using groupby:
groups=dataframe.groupby('type')
But how could I call the groupby object with the rows where type is 32? And what would be the best what to separate only the top 3 by growth?