This repository has been archived on 2023-06-18. You can view files and clone it, but cannot push or open issues or pull requests.
ima02/metric_stats.py

22 lines
811 B
Python
Raw Normal View History

2023-05-24 12:06:24 +00:00
#!/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()