'Extracting rows from list in data frame where at max numbers [duplicate]

So i've been given a pandas data frame and created a definition for the maximum variable in one column.

max_energy = D202['USAGE'].max() max_energy

I need to extract the rows with maximum values



Solution 1:[1]

Use:

 df = D202[D202['USAGE'].eq(D202['USAGE'].max())]

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1