I have one data frame df:
fruit date volume
0 apple 20141001 2000
1 apple 20141101 1800
2 apple 20141201 2200
3 orange 20141001 1900
4 orange 20141101 2000
5 orange 20141201 3000
….
and I have following two data frames
apple:
date price
0 20141001 2
1 20141101 2.5
2 20141201 3
orange:
date price
0 20141001 1.5
1 20141101 2
2 20141201 2
how can I merge all these in to the following data frame:
fruit date price volume
0 apple 20141001 2 2000
1 apple 20141101 2.5 1800
2 apple 20141201 3 2200
3 orange 20141001 1.5 1900
4 orange 20141101 2 2000
5 orange 20141201 2 3000
….
This is just a example, in my real work, I have hundreds of 'fruit' with price data need to be merged into the first data frame.
should I use merge or join? what is the difference between them? Thank you.