1

I have the following data frame a:

      date      Y   
0   2012-01-01  10  
1   2012-01-02  20  
2   2012-01-03  30  

And another data frame b containig:

      date      X   
0   2012-01-01  a   
1   2012-01-01  b   
2   2012-01-02  c   
3   2012-01-03  d
4   2012-01-03  e   
5   2012-01-03  f   

The dates in b are repeted, but in a are unique. My desired output is:

      date      X   Y
0   2012-01-01  a   10
1   2012-01-01  b   10
2   2012-01-02  c   20
3   2012-01-03  d   30
4   2012-01-03  e   30
5   2012-01-03  f   30

So far, I have tried b.merge(a, on=['date']) but this returns a data frame with more rows than b.

shuls
  • 11
  • 3

0 Answers0