You can reindex with method=" nearest ". There may be a neater way, but using a.
merge () can't do this kind of join, but you can use searchsorted(): Create some Ask Question I have two dataframes, both of which contain an irregularly spaced, import pandas as pd import numpy as np base . do a regular merge with outer join (how='outer');; sort it by date ;; use..
Questions merge data frames based nearest date - tri
One thing you can do to find the closest date might be something to calc the number of days between each date in the first DataFrame and the dates in the second DataFrame. Learn more about Stack Overflow the company. Sign up or log in.