def fancify_summary(expr):
 seen_names.clear()
 name_dict.clear()
 exprs = pipe(expr.values, map(Expr._traverse), concat, filter((lambda x: isinstance(x, Reduction))), set)
 one = summary(**dict(((_name(expr), expr) for expr in exprs)))
 two = dict(((_name(expr), symbol(_name(expr), (datashape.var * expr.dshape))) for expr in exprs))
 d = dict(((expr, two[_name(expr)]) for expr in exprs))
 three = dict(((name, value._subs(d)) for (name, value) in zip(expr.names, expr.values)))
 return (one, two, three)

def fancify_summary ( expr ) : seen_names . clear ( ) name_dict . clear ( ) exprs = pipe ( expr . values , map ( Expr . _traverse ) , concat , filter ( ( lambda x : isinstance ( x , Reduction ) ) ) , set ) one = summary ( ** dict ( ( ( _name ( expr ) , expr ) for expr in exprs ) ) ) two = dict ( ( ( _name ( expr ) , symbol ( _name ( expr ) , ( datashape . var * expr . dshape ) ) ) for expr in exprs ) ) d = dict ( ( ( expr , two [ _name ( expr ) ] ) for expr in exprs ) ) three = dict ( ( ( name , value . _subs ( d ) ) for ( name , value ) in zip ( expr . names , expr . values ) ) ) return ( one , two , three )
separate a complex summary into two pieces helps pandas compute_by on summaries .