Client has an Index (Russell 2500 Growth) and is pulling P/E FY1 using Tr.PriceClose and Tr.EPSMean FY1 , and then finding the weighted average. And now has a question about methodology.
Below Client is pulling PE values that include negative and do NOT include negative values:
Index_PE_nonneg = (Index_PE['Earnings Per Share - Mean FY1'] > 0) & (Index_PE['Earnings Per Share - Mean FY2'] > 0) ]
Index_PE['Index Weight']=Index_PE['Index Weight']/Index_PE['Index Weight'].sum()
Index_PE_nonneg['Index Weight'] = Index_PE_nonneg['Index Weight']/Index_PE_nonneg['Index Weight'].sum()
And pulling Weights of the each consituent:
Index_MC = Index_DF_Raw[['Index Weight','Index Shares','Company Market Cap (Millions)','Price Close']].sort_values(by = 'Company Market Cap (Millions)',ascending = False)
MC_Available = Index_DF_Raw['Company Market Cap (Millions)'].notnull().sum()
Index_MC.dropna(subset=['Company Market Cap (Millions)'],inplace=True)
Index_MC['Index Weight'] = Index_MC['Index Weight']/Index_MC['Index Weight'].sum()
for i in range(3):
if i == 0:
Index_PE_nonneg['PE FY{}'.format(i)] = Index_PE_nonneg["Price Close"]/Index_PE_nonneg['Diluted EPS Excluding Extraordinary Items FY{}'.format(i)]
Index_PE['PE FY{}'.format(i)] = Index_PE["Price Close"]/Index_PE['Diluted EPS Excluding Extraordinary Items FY{}'.format(i)]
else:
Index_PE_nonneg['PE FY{}'.format(i)] = Index_PE_nonneg["Price Close"]/Index_PE_nonneg['Earnings Per Share - Mean FY{}'.format(i)]
Index_PE['PE FY{}'.format(i)] = Index_PE["Price Close"]/Index_PE['Earnings Per Share - Mean FY{}'.format(i)]
Index_PE_nonneg['HM FY{}'.format(i)] = Index_PE_nonneg['Index Weight']/Index_PE_nonneg['PE FY{}'.format(i)]
Index_PE['HM FY{}'.format(i)] = Index_PE['Index Weight']*(1/Index_PE['PE FY{}'.format(i)])
Index_HM['FY{} positive'.format(i)] = round(1/Index_PE_nonneg['HM FY{}'.format(i)].sum(),2)
Index_HM['FY{} incl neg'.format(i)] = round(1/Index_PE['HM FY{}'.format(i)].sum(),2)
Client has a question regarding how python integrates negative PE values, how they incorporate very high PE and very low PE values in part of the weighted average.