#NEWLINE# def _generic_summary( arg , exact_nunique = False , prefix = None ) : #NEWLINE# #INDENT# '\n    Compute a set of summary metrics from the input value expression\n\n    Parameters\n    ----------\n    arg : value expression\n    exact_nunique : boolean, default False\n      Compute the exact number of distinct values (slower)\n    prefix : string, default None\n      String prefix for metric names\n\n    Returns\n    -------\n    summary : (count, # nulls, nunique)\n    ' #NEWLINE# metrics = [ arg . count ( ) , arg . isnull ( ) . sum ( ) . name ( 'nulls' ) ] #NEWLINE# if exact_nunique : #NEWLINE# #INDENT# unique_metric = arg . nunique ( ) . name ( 'uniques' ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# unique_metric = arg . approx_nunique ( ) . name ( 'uniques' ) #NEWLINE# #UNINDENT# metrics . append ( unique_metric ) #NEWLINE# return _wrap_summary_metrics ( metrics , prefix )