I have a dataframe(df1) as following:
       datetime     m  d    1d    2d   3d
       2014-01-01   1  1     2     2   3
       2014-01-02   1  2     3     4   3
       2014-01-03   1  3     1     2   3
       ...........
       2014-12-01  12  1      2     2   3
       2014-12-31  12  31     2     2   3
Also I have another dataframe(df2) as following:
       datetime     m  d       
       2015-01-02   1  2     
       2015-01-03   1  3     
       ...........
       2015-12-01  12  1      
       2015-12-31  12  31     
I want to merge the 1d 2d 3d columns value of df1 to df2. There are two conditions: (1) only m and d are the same in both df1 and df2 can merge. (2) if the index of df2 index % 30 ==0 don't merge, the value of 1d 2d 3d of these index can be Nan.
I mean I want the new dataframe of df2 like as following:
       datetime     m  d    1d    2d   3d
       2015-01-02   1  2   Nan     Nan   Nan
       2015-01-03   1  3     1     2   3
       ...........
       2015-12-01  12  1      2     2   3
       2015-12-31  12  31     2     2   3
Thanks in advance!
 
     
    