financial tech - - in [ ]by_industry describe(out[ ]momentum shortinterest value industry financial count mean - std min - - - - max - tech count mean - std min - - - - max - by defining transformation functionsit' easy to transform these portfolios by industry for examplestandardizing within industry is widely used in equity portfolio constructionwithin-industry standardize def zscore(group)return (group group mean()group std(df_stand by_industry apply(zscoreyou can verify that each industry has mean and standard deviation in [ ]df_stand groupby(industriesagg(['mean''std']out[ ]momentum shortinterest value mean std mean std mean std industry financial tech - - - otherbuilt-in kinds of transformationslike rankcan be used more conciselywithin-industry rank descending in [ ]ind_rank by_industry rank(ascending=falsein [ ]ind_rank groupby(industriesagg(['min''max']out[ ]momentum shortinterest value min max min max min max industry financial tech group transforms and analysis www it-ebooks info