master-thesis/util/files-and-dirs.py
2021-08-20 12:22:04 +02:00

36 lines
1.2 KiB
Python
Executable File

import pandas as pd
import seaborn as sns
import matplotlib.pyplot as plt
if __name__ == '__main__':
data = pd.read_csv('commit_files.csv')
help_df = pd.DataFrame(columns=['project', 'tipo', 'files/dirs', 'value'])
for i, row in data.iterrows():
project = row['project']
help_df = help_df.append(
{'project': project, 'tipo': 'No ML', 'files/dirs': 'Files', 'value': row['no_ml_files_ratio']},
ignore_index=True
)
help_df = help_df.append(
{'project': project, 'tipo': 'ML', 'files/dirs': 'Files', 'value': row['ml_files_ratio']},
ignore_index=True
)
help_df = help_df.append(
{'project': project, 'tipo': 'No ML', 'files/dirs': 'Directories', 'value': row['no_ml_dirs_ratio']},
ignore_index=True
)
help_df = help_df.append(
{'project': project, 'tipo': 'ML', 'files/dirs': 'Directories', 'value': row['ml_dirs_ratio']},
ignore_index=True
)
plot = sns.boxplot(x='files/dirs', y='value', hue='tipo', data=help_df)
plot.set_title('Percentuali di files e directories modificate')
plot.set_ylabel('')
plt.tight_layout()
plt.savefig('../src/figures/files-and-directories.pdf')