@pandas_udf(p2, PandasUDFType.GROUPED_MAP)
def _dailystat(key, df):
    d = df.loc[:, ['q_dtprofit_ttm_poly', 'q_gr_poly', 'q_profit_poly', 'q_dtprofit_poly', 'q_opincome_poly', 'industry_roe', 'industry_pe', 'roe_ttm', 'industry_pe_ttm']]
    st = d.describe([0.25, 0.5, 0.75, 0.85, 0.95]).T.reset_index(level=0)
    col = ['category']
    col = (col + new2_struct)
    st.columns = col
    st.loc[:, 'industry'] = key[0]
    median = d.median()
    mad = abs((d - median)).median()
    d[((d - (median - ((mad * 3) * 1.4826))) < 0)] = np.array(((median - ((mad * 3) * 1.4826)).tolist() * d.shape[0])).reshape((d.shape[0], d.columns.size))
    d[((d - (median + ((mad * 3) * 1.4826))) > 0)] = np.array(((median + ((mad * 3) * 1.4826)).tolist() * d.shape[0])).reshape((d.shape[0], d.columns.size))
    st2 = d.describe([0.25, 0.5, 0.85, 0.9, 0.95]).T.reset_index(level=0)
    st2.columns = col
    st2.loc[:, 'industry'] = key[0]
    st2.category = (st2.category + '_mad')
    return pd.concat([st, st2])
@pandas_udf(p2, PandasUDFType.GROUPED_MAP)
def _dailystat(key, df):
    d = df.loc[:, ['q_dtprofit_ttm_poly', 'q_gr_poly', 'q_profit_poly', 'q_dtprofit_poly', 'q_opincome_poly', 'industry_roe', 'industry_pe', 'roe_ttm', 'industry_pe_ttm']]
    st = d.describe([0.25, 0.5, 0.75, 0.85, 0.95]).T.reset_index(level=0)
    col = ['category']
    col = (col + new2_struct)
    st.columns = col
    st.loc[:, 'industry'] = key[0]
    median = d.median()
    mad = abs((d - median)).median()
    d[((d - (median - ((mad * 3) * 1.4826))) < 0)] = np.array(((median - ((mad * 3) * 1.4826)).tolist() * d.shape[0])).reshape((d.shape[0], d.columns.size))
    d[((d - (median + ((mad * 3) * 1.4826))) > 0)] = np.array(((median + ((mad * 3) * 1.4826)).tolist() * d.shape[0])).reshape((d.shape[0], d.columns.size))
    st2 = d.describe([0.25, 0.5, 0.85, 0.9, 0.95]).T.reset_index(level=0)
    st2.columns = col
    st2.loc[:, 'industry'] = key[0]
    st2.category = (st2.category + '_mad')
    return pd.concat([st, st2])