Encapsulate average_mkn

This commit is contained in:
Quentin Legot 2023-03-24 11:12:40 +01:00
parent 8d50ce6725
commit 8a556e999a

View File

@ -7,22 +7,26 @@ nb_files = os.listdir(".." + os.sep + "export")
size = len(nb_files) size = len(nb_files)
# main array
averages = np.empty((size, 2))
nb = 0
for i in nb_files:
data = pd.read_csv(".." + os.sep + "export" + os.sep + i, delimiter=';').to_numpy()
rb = data[:, 4]
total = 0.0 def mean_mkn() -> np.ndarray:
for x in rb: averages_mkn = np.empty((size, 2))
total = total + x nb = 0
average = total / len(rb) for i in nb_files:
nb_users = i.split(".")[0] data = pd.read_csv(".." + os.sep + "export" + os.sep + i, delimiter=';').to_numpy()
averages[nb, 0] = int(nb_users) rb = data[:, 4]
averages[nb, 1] = average
nb += 1
total = 0.0
for x in rb:
total = total + x
average = total / len(rb)
nb_users = i.split(".")[0]
averages_mkn[nb, 0] = int(nb_users)
averages_mkn[nb, 1] = average
nb += 1
return averages_mkn
averages = mean_mkn()
# Data for plotting # Data for plotting
averages.sort(axis=0) averages.sort(axis=0)
x = averages[:, 0] x = averages[:, 0]