Skip to content
Advertisement

Python: How to find 5 lowest values in data frame column?

I have a data frame that looks something like this:

JavaScript

I want to get the IDs of the rows with the five lowest Vmag values. Is there a convenient way to achieve this?

Advertisement

Answer

Try df.nsmallest(5, 'Vmag')['ID']

User contributions licensed under: CC BY-SA
6 People found this is helpful
Advertisement