Python Forum

Full Version: dealing with big data of timestamp
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
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 !!