I have a dataframe with datetime index from 2006-01-19 to 2007-01-25 like this:
YEAR DOY temperature datetime 2016-01-19 2016.0 NaN 2016-01-20 2016.0 NaN 2016-01-21 2016.0 NaN 2016-01-22 2016.0 NaN 2016-01-23 2016.0 NaN ..... 2017-01-24 2017.0 NaN All temperature values in the dataframe above are NaNs.
I want to join another dataframe containing temperature values for each day of the year (366 in all):
YEAR DOY temperature 0 2013 1 3.66 1 2013 2 4.00 2 2013 3 1.38 3 2013 4 -0.44 ..... 4 2013 366 0.22 I want to join these dataframes based on the DOY column so that e.g. day 22 of the first dataframe has temperature value that is obtained for day 22 from the second dataframe. I tried this:
df_a.merge(df_b, on='DOY', suffixes=('_x', '')) However, this does not work. How do I fix it?