I have a data frame that looks something like this:
ID Ah Am RAs Ed Em DEs Vmag U-B B-V V-I e_ e_ e_ e_ _ _ _ _ mb n_ 2MASS 1 10 42 57.6 -59 47 22.6 18.681 1.105 1.461 0.002 0.103 0.053 2 0 1 2 10425765-5947229 2 10 42 57.7 -59 44 22.2 18.303 2.764 0.012 0.013 2 0 0 2 3 10 42 57.7 -59 46 58.0 18.610 1.573 0.038 0.039 2 0 0 2 10425776-5946583 4 10 42 57.8 -59 47 49.5 12.870 0.764 0.799 0.009 0.009 0.009 3 0 1 3 10425773-5947495 5 10 42 57.8 -59 44 03.4 18.815 1.072 1.433 0.017 0.110 0.043 2 0 1 2 6 10 42 57.8 -59 48 29.3 18.697 1.304 0.014 0.019 2 0 0 2 10425778-5948293 7 10 42 57.8 -59 44 08.5 17.817 1.700 2.384 0.011 0.108 0.013 2 0 1 2 10425786-5944083 8 10 42 57.9 -59 43 11.1 18.621 0.925 1.322 0.014 0.084 0.014 2 0 1 2 9 10 42 58.0 -59 41 34.4 16.993 0.998 1.742 0.003 0.027 0.003 3 0 1 3 10425799-5941342 10 10 42 58.0 -59 49 23.3 16.981 0.656 1.043 0.023 0.034 0.023 3 0 1 3 10425796-5949235 11 10 42 58.1 -59 48 20.2 17.047 0.926 1.003 0.009 0.034 0.017 3 0 1 3 12 10 42 58.1 -59 47 51.5 17.535 0.879 1.197 0.008 0.071 0.035 2 0 1 2 13 10 42 58.2 -59 47 16.9 15.982 0.854 1.146 0.006 0.011 0.008 3 0 1 3 10425820-5947169
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']