I'm fairly new at python, and would like to perform correlation between 2 dataframes.
df1 = pd.DataFrame({'Date':['2015-01-04','2015-01-05','2015-01-06'],
'stockprice1':['1.01','1.01','1.01',],
'stockprice2':['1.04','1.05','1.03',]})
df2 = pd.DataFrame({'Date':['2015-01-04','2015-01-05','2015-01-06'],
'variable1':['1.11','1.21','1.31',],
'variable2':['2.01','2.04','2.03',]})
result = df1.corrwith(df2)
My intended output would look something like a 2x2 display of the correlation coefficients (of stockprice vs. variable). However, the code below doesn't seem to work, does anyone know what i'm doing wrong?