I would like to add to create the column new_column with the corresponding values from the second data frame.
Asked
Active
Viewed 757 times
0
-
5Please post text rather than images, also I think this should work: `df['new_column'] = other_df['Equity(24 AAPL)']` – EdChum Dec 10 '15 at 21:44
-
Please follow: [How to make good reproducible pandas examples](http://stackoverflow.com/questions/20109391/how-to-make-good-reproducible-pandas-examples) – Kartik Dec 10 '15 at 23:59
-
Thanks for the link, I was struggling on how to explain my question. – qtmspin Dec 11 '15 at 13:01
1 Answers
0
df_sp_500_long = pd.melt(df_sp_500_long.reset_index(),
id_vars='date', var_name='symbol',
value_name='new_column')
(first_df
.reset_index()
.merge(df_sp_500_long, on=['date','symbol'], how='left'))

attitude_stool
- 1,023
- 1
- 13
- 18