Reputation: 65
The following 2 series of stocks in a single excel file:
Can be combined using the date as index?
The result should be like this:
Upvotes: 0
Views: 51
Reputation: 34046
You need a simple df.merge()
here:
df = pd.merge(df1, df2, left_index=True, right_index=True, how='outer')
OR
df = df1.join(df2, how='outer')
Upvotes: 1
Reputation: 65
I am trying this:
df3 = pd.concat([df1, df2]).sort_values('Date').reset_index(drop=True)
or
df3 = df1.append(df2).sort_values('Date').reset_index(drop=True)
Upvotes: 1