I would like to compute the portfolio turnover for a monthly rebalanced portfolio that looks this:
df = pd.DataFrame({'Date': ['6/30/2015','6/30/2015','6/30/2015','7/30/2015','7/30/2015','7/30/2015'],'Ticker': ['AAPL','MSFT','IBM','AAPL','MSFT','AMZN']})
df['Date']=pd.to_datetime(df['Date'])
In particular, I would like to know for each month, how many of the positions in the portfolio were replaced. So for July it should show 1/3, since IBM was replaced with AMZN.