Jul-27-2018, 01:23 PM
def function(time): return df.iloc[df.index.get_loc(time,method='nearest'),9] series.apply(function)hello everyone, I have a dataframe indexed by timestamp and I have as well a series of time (not necessarily exist in the dataframe index). I want for every time to extract a value from the dataframe corresponding to the nearest timestamp. I am running the code above, it works fine but when use it with a big dataframe (1 million rows) it takes days to be executed. Can anyone help please !!