Return top N largest values per group using pandas
问题 I am trying to find maximum values in number of series each grouped by name of the column it was extracted from. I have a dataframe as such: MASTER SLAVE Value Master_1 Slave_1 657879 Master_1 Slave_2 34343 Master_1 Slave_3 453313 Master_2 Slave_1 56667 Master_2 Slave_2 6879 Master_2 Slave_3 12333 Master_2 Slave_4 789 Master_2 Slave_5 22235 Master_3 Slave_1 65765 Master_3 Slave_2 23431 Master_3 Slave_3 445 Master_3 Slave_4 567 I need to find maximum values of first two slaves of each master.