Q: Pandas: Fill and merge two different data-frames based on condition in index column I have two DataFrame, the first one is NYC taxis data set in January contain (10678070 rows and 7 columns), the second is NYC weather data set, also for January ( 864 rows and 30 columns) for each hours as following:
df2.head()

weather.head()

So now, what I want to do is merge the two dataframes or add a weather columns details to df2 based on trip date and time is equal or less than weather record.
So that, if Column (tpep_pickup_datetime) in df2 is matching or less than (tpep_pickup_datetime) in weather , value the rows from weather are appended to the corresponding row in df2.
I tried that by using the merge function (merge_asof), like this:
import pandas


# Sort data before merge then merge
df2.sort_values(by='tpep_pickup_datetime', inplace=True)
weather.sort_values(by='tpep_pickup_datetime', inplace=True)
dmerge=pandas.merge_asof(df2,weather, on="tpep_pickup_datetime", tolerance=pandas.Timedelta('31m'))

But I get df2 with NAN values in weather columns, like this:
dmerge.head()

Is there a smooth way to do this in pandas?
Thanks for all in advance!
