I am trying to 'calculate the weighted return for my portfolio assuming assuming an equal number of shares for each stock'. I am looking at three stocks.
I combined all three stocks as so:
my_portfolio = pd.concat([appl_df, cost_df, goog_df], axis='columns', join='inner')
my_portfolio.columns = ['APPL', 'COST', 'GOOG']
my_portfolio_return = my_portfolio.sort_index()
my_portfolio_return.head()
Now I tried to set the weights as follow and then calculate my weighted portfolio; the only thing is I am not sure if I am using the correct syntax (dot).
# Set weights
weights = [1/3, 1/3, 1/3]
# Calculate portfolio return
weighted_portfolio = my_portfolio_return.dot(weights)
weighted_portfolio.sum
weighted_portfolio
Can anyone tell me what I'm doing wrong?