I have a df1 that looks like this:
Symbol Order Shares
Date
2009-01-14 AAPL BUY 150
2009-01-21 AAPL SELL 150
2009-01-21 IBM BUY 400
And df2 looks like this:
GOOG AAPL XOM IBM Cash
Date
2009-01-14 NaN NaN NaN NaN NaN
2009-01-21 NaN NaN NaN NaN NaN
I want to move the values in the first DF to the second so that the amount of shares populates under the appropriate stock symbol. So the above would look like:
GOOG AAPL XOM IBM Cash
Date
2009-01-14 NaN 150 NaN NaN NaN
2009-01-21 NaN -150 NaN 400 NaN
How would I move all values that I have in my first dataframe to the second dataframe?
df.pivot(None, 'Symbol', 'Shares')