I am still quite new to joining/merging data in Pandas, so would therefore very much appreciate any help to do the following operation. I have the following three SQL tables (converted to DataFrames) of data:
df1
Out[14]:
---- fruit price qty
2010 apple 1.0 2.0
2011 apple 3.0 4.0
2010 banana 0.5 1.5
2011 banana 7.0 8.0
df2
Out[15]:
---- fruit weight
2010 apple 10
2010 banana 12
df3
Out[16]:
-- fruit colour
0 apple red
1 banana yellow
Where df2 has the same fruits as df1, but not the same years (I'm almost completely sure that df2's years are a subset of df1, although it would be nice to find a method, that allows for years in df2 that aren't included in df1). Df3 is a table with characters for all the fruits contained in df2 and df1. I would like to merge the three tables together, so each row in the new combined DataFrame has year, fruit, price, qty, weight (possibly NaN) and colour. I am not sure if such a data structure would be best contained in a Panel or a DataFrame - inputs on this are also very welcome. Thanks!