import pandas as pd
a = pd.DataFrame({'value': [0, 1, float('nan'), 3, 4, float('nan')]
I would like to find a location with the nan
value in a
above. index
Without using the value
First of all,
a['value'].Find the
I'm trying to find the location (order) where the nan
value with isnull()nan
value is located, but I don't know how to find the last location. Of course, I can make the code complicated, but it's getting too long, so I'm asking if there's a simple way.
It's the last one with iloc.If it's too long, I don't have to say.
a[a['value'].isnull()].iloc[-1]
© 2024 OneMinuteCode. All rights reserved.