I have the two following datasets:
dataset1
ticker date
0 AAPL 1/12/05
1 GOOG 1/12/05
2 GOOG 3/11/06
3 BRKA 3/11/06
4 NVDA 3/11/06
5 GME 4/8/07
6 AAPL 4/8/07
7 BRKA 4/8/07
8 GOOG 4/8/07
9 AMGN 4/8/07
dataset2
ticker price date
0 AAPL 30 1/12/05
1 GOOG 24 1/12/05
2 BRKA 40 1/12/05
3 AAPL 31 3/11/06
4 GOOG 21 3/11/06
5 BRKA 32 3/11/06
6 NVDA 19 3/11/06
7 TSLA 16 3/11/06
8 AMZN 17 4/8/07
9 TSLA 30 4/8/07
10 NVDA 12 4/8/07
11 GME 26 4/8/07
12 AAPL 12 4/8/07
13 BRKA 16 4/8/07
14 GOOG 48 4/8/07
15 AMGN 36 4/8/07
I would like to create a third dataset which would match the tickers in both datasets with their matching dates(in dataset1) and dates(in dataset2), to finally get a third dataset that would look like this:
dataset3
ticker date price
0 AAPL 1/12/05 30
1 GOOG 1/12/05 24
2 GOOG 3/11/06 21
3 BRKA 3/11/06 32
4 NVDA 3/11/06 19
5 GME 4/8/07 26
6 AAPL 4/8/07 12
7 BRKA 4/8/07 16
8 GOOG 4/8/07 48
9 AMGN 4/8/07 36
Basically I need to merge the two datasets based on several matching values in multiple columns. I have tried a classic pd.merge but that only lets me choose one specific date, rather than match the dates across two datasets.
Thank you for your help and time. It is much appreciated.