#!/usr/bin/env python3

import pandas as pd
import os

def main():
    dfs = pd.read_csv(os.path.dirname(__file__) + '/metrics/feature_vectors_labeled.csv')
    metrics = ['MTH', 'FLD', 'RFC', 'INT', 'SZ', 'CPX', 'EX', 'RET', 'BCM', 
        'NML', 'WRD', 'DCM']
    df = dfs.agg(dict([(m, ['min', 'max', 'mean']) for m in metrics])).reset_index()
    df = pd.melt(df, id_vars=['index'], value_vars=metrics, var_name='metric') \
        .pivot(index='metric', columns=['index'], values=['value']) \
        .reset_index()
    df.columns = sorted([c[1] for c in df.columns])
    df = df.reindex([df.columns[0]] + list(reversed(sorted(df.columns[1:]))), axis=1)
    print(df.to_markdown(index=False))

    print()
    print(dfs.groupby('buggy').count().loc[:, 'class_name'])

if __name__ == '__main__':
    main()