I am analyzing some optical spectra data and my dataframe indices are numbers that have some 9 decimal place accuracy. If I don’t type in the exact index, the dataframe won’t return a value. I am having to use df.iloc(N), but this requires me to continue guessing which index is closest to the desired index. Isn’t there some way where I type in df[600], it provides me index closest to that number?
I tried iloc. There is also the over the top tedious solution of first locating the index manually,
df.index[np.abs(df.index – target_value).argmin()] and then using that index, but isn’t there some faster way to do this?