nussl/evaluation/report_card.py
def _get_report_card(df, func, report_each_source=True, decs=2):
    """
    Gets a report card for a DataFrame using a specific function.
    """
    labels, data = func(df, decs=decs)

    data.insert(0, 'OVERALL')
    data = [data]

    if report_each_source:
        for name in np.unique(df['source']):
            _df = df[df['source'] == name]
            _, _data = func(_df, decs=decs)
            _data.insert(0, name.upper())
            data.append(_data)
    
    # transposing data so each column has the source and its metrics
    data = list(map(list, zip(*data)))
    header = data.pop(0)
    header.insert(0, 'METRIC')
    for i in range(1, len(header)):
        header[i] = _format_title(header[i], 16)
    for l, d in zip(labels, data):
        d.insert(0, l)
        
    alignment = ["c" for _ in header]
    alignment[0] = "l"
    alignment = ''.join(alignment)
    
    report_card = termtables.to_string(
        data, header=header, padding=(0, 1), alignment=alignment)

    return report_card

    Gets a report card for a DataFrame using a specific function.
    
Gets a report card for a DataFrame using a specific function.
Gets a report card for a DataFrame using a specific function .
def _get_report_card(df, func, report_each_source=True, decs=2):
    labels, data = func(df, decs=decs)
    data.insert(0, 'OVERALL')
    data = [data]
    if report_each_source:
        for name in np.unique(df['source']):
            _df = df[df['source'] == name]
            _, _data = func(_df, decs=decs)
            _data.insert(0, name.upper())
            data.append(_data)
    data = list(map(list, zip(*data)))
    header = data.pop(0)
    header.insert(0, 'METRIC')
    for i in range(1, len(header)):
        header[i] = _format_title(header[i], 16)
    for l, d in zip(labels, data):
        d.insert(0, l)
    alignment = ["c" for _ in header]
    alignment[0] = "l"
    alignment = ''.join(alignment)
    report_card = termtables.to_string(
        data, header=header, padding=(0, 1), alignment=alignment)
    return report_card
def _get_report_card ( df , func , report_each_source = True , decs = 2 ) : labels , data = func ( df , decs = decs ) data . insert ( 0 , 'OVERALL' ) data = [ data ] if report_each_source : for name in np . unique ( df [ 'source' ] ) : _df = df [ df [ 'source' ] == name ] _ , _data = func ( _df , decs = decs ) _data . insert ( 0 , name . upper ( ) ) data . append ( _data ) data = list ( map ( list , zip ( * data ) ) ) header = data . pop ( 0 ) header . insert ( 0 , 'METRIC' ) for i in range ( 1 , len ( header ) ) : header [ i ] = _format_title ( header [ i ] , 16 ) for l , d in zip ( labels , data ) : d . insert ( 0 , l ) alignment = [ "c" for _ in header ] alignment [ 0 ] = "l" alignment = '' . join ( alignment ) report_card = termtables . to_string ( data , header = header , padding = ( 0 , 1 ) , alignment = alignment ) return report_card
Gets a report card for a DataFrame using a specific function.
Gets a report card for a DataFrame using a specific function .
"""
    Gets a report card for a DataFrame using a specific function.
    """ # transposing data so each column has the source and its metrics
df
func
report_each_source
decs