0

I have the below code

dateseries=pd.date_range('1996-10-31','2019-01-05',freq='B')
df1['Date']=pd.DataFrame(dateseries,columns=['Date'])

I want to add a column for sum for each date in this dataframe (df) from another dataframe (say df2, that has multiple values for same date) based on date filters

df1
Date
1996-10-31
1996-11-01
1996-11-02

df2
Date       Val   
1996-10-31   5
1996-10-31   6
1996-10-31   4
1996-11-01   7
1996-11-01   9

I want the final output in df1 as below

df1
Date        Val
1996-10-31   15
1996-11-01   16
trotta
  • 1,232
  • 1
  • 16
  • 23

0 Answers0