Skip to content

Commit 97ec715

Browse files
committed
updated
1 parent 4e16da5 commit 97ec715

File tree

5 files changed

+264
-134
lines changed

5 files changed

+264
-134
lines changed

calculations.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
# Імпортуємо модуль math
22
import math
3+
34
# Імпортуємо pearsonr, ttest_ind з модулю scipy
45
from scipy.stats import pearsonr, ttest_ind
56

@@ -62,7 +63,9 @@ def covariance(data_x: list, data_y: list) -> float:
6263
sub_x = [i - mean_x for i in data_x]
6364
sub_y = [i - mean_y for i in data_y]
6465
# Потім відбувається підсумовування cум відповідних елементів і результат ділиться на (n-1), де n - кількість елементів у списку data_x
65-
return round(sum([sub_x[i] * sub_y[i] for i in range(len(sub_x))]) / (len(data_x) - 1), 2)
66+
return round(
67+
sum([sub_x[i] * sub_y[i] for i in range(len(sub_x))]) / (len(data_x) - 1), 2
68+
)
6669

6770

6871
def pearson(data_x: list, data_y: list) -> float:
@@ -76,4 +79,3 @@ def t_test(data_x: list, data_y: list) -> str:
7679
res = str(round(t_statistic, 2)) + ", " + str(round(p_value, 2))
7780
# Повертає t-статистику та p-значення для t-тесту незалежних вибірок
7881
return res
79-

chernovik.py

Lines changed: 32 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -118,17 +118,17 @@ def close_window(self):
118118
@Decorators
119119
def rad_button(self):
120120
x = 0
121-
for i, food_item in enumerate(self.funcs):
121+
for i, food_item in enumerate(self.funcs):
122122
self.funcs_dict[food_item] = Checkbutton(text=food_item, bg="#DDCE84")
123123

124124
# Create a new instance of IntVar() for each checkbutton
125125
self.funcs_dict[food_item].var = IntVar()
126126

127127
# Set the variable parameter of the checkbutton
128-
self.funcs_dict[food_item]['variable'] = self.funcs_dict[food_item].var
128+
self.funcs_dict[food_item]["variable"] = self.funcs_dict[food_item].var
129129

130130
# Arrange the checkbutton in the window
131-
self.funcs_dict[food_item].pack(anchor='w')
131+
self.funcs_dict[food_item].pack(anchor="w")
132132
Canvas(self.window, height=1, width=900, bg="yellow").pack()
133133
Label(
134134
self.window,
@@ -323,19 +323,18 @@ def show2(self, patient_entry):
323323
f"{table.get_string()}"
324324
)
325325

326-
327326
def show333(self):
328327
for cb in self.funcs_dict.values():
329328
if cb.var.get():
330-
print(cb['text'])
329+
print(cb["text"])
331330

332331
@Decorators
333332
def show(self, pokaz_entry):
334333
for cb in self.funcs_dict.values():
335334
if cb.var.get():
336335
if self.flag:
337336
Prog.pokaz_entry = pokaz_entry.get()
338-
if cb['text'] == "Середнє арифметичне":
337+
if cb["text"] == "Середнє арифметичне":
339338
res = Prog.pokaz_entry.split(",")
340339
for i in res:
341340
self.show_histo(
@@ -368,7 +367,7 @@ def show(self, pokaz_entry):
368367
value=value,
369368
)
370369
Prog.db.get_rand_excel()
371-
elif cb['text'] == "Мінімальне значення":
370+
elif cb["text"] == "Мінімальне значення":
372371
res = Prog.pokaz_entry.split(",")
373372
for i in res:
374373
self.show_histo(
@@ -400,7 +399,7 @@ def show(self, pokaz_entry):
400399
),
401400
)
402401
Prog.db.get_rand_excel()
403-
elif cb['text'] == "Максимальне значення":
402+
elif cb["text"] == "Максимальне значення":
404403
res = Prog.pokaz_entry.split(",")
405404
for i in res:
406405
self.show_histo(
@@ -432,10 +431,7 @@ def show(self, pokaz_entry):
432431
),
433432
)
434433
Prog.db.get_rand_excel()
435-
elif (
436-
cb['text']
437-
== "Середньоквадратичне відхилення по вибірці"
438-
):
434+
elif cb["text"] == "Середньоквадратичне відхилення по вибірці":
439435
res = Prog.pokaz_entry.split(",")
440436
for i in res:
441437
self.show_histo(
@@ -467,7 +463,7 @@ def show(self, pokaz_entry):
467463
),
468464
)
469465
Prog.db.get_rand_excel()
470-
elif cb['text'] == "Коефіцієнт варіації":
466+
elif cb["text"] == "Коефіцієнт варіації":
471467
res = Prog.pokaz_entry.split(",")
472468
for i in res:
473469
self.show_histo(
@@ -499,7 +495,7 @@ def show(self, pokaz_entry):
499495
),
500496
)
501497
Prog.db.get_rand_excel()
502-
elif cb['text'] == "Помилка середнього":
498+
elif cb["text"] == "Помилка середнього":
503499
res = Prog.pokaz_entry.split(",")
504500
for i in res:
505501
self.show_histo(
@@ -531,7 +527,7 @@ def show(self, pokaz_entry):
531527
),
532528
)
533529
Prog.db.get_rand_excel()
534-
elif cb['text'] == "Коваріація":
530+
elif cb["text"] == "Коваріація":
535531
val = Prog.pokaz_entry.split(",")
536532
res = str(val[0]) + " " + str(val[1])
537533
self.cor_graph(
@@ -575,9 +571,7 @@ def show(self, pokaz_entry):
575571
),
576572
)
577573
Prog.db.get_rand2_excel()
578-
elif (
579-
cb['text'] == "Коефіцієнт кореляції Пірсона"
580-
):
574+
elif cb["text"] == "Коефіцієнт кореляції Пірсона":
581575
val = Prog.pokaz_entry.split(",")
582576
res = str(val[0]) + " " + str(val[1])
583577
self.cor_graph(
@@ -621,7 +615,7 @@ def show(self, pokaz_entry):
621615
),
622616
)
623617
Prog.db.get_rand2_excel()
624-
elif cb['text'] == "Т-критерий Стюдента":
618+
elif cb["text"] == "Т-критерий Стюдента":
625619
val = Prog.pokaz_entry.split(",")
626620
res = str(val[0]) + " " + str(val[1])
627621
self.cor_graph(
@@ -666,7 +660,7 @@ def show(self, pokaz_entry):
666660
)
667661
Prog.db.get_rand2_excel()
668662
else:
669-
if cb['text'] == "Середнє арифметичне":
663+
if cb["text"] == "Середнє арифметичне":
670664
res = pokaz_entry.get().split(",")
671665
for i in res:
672666
self.show_histo(
@@ -677,7 +671,7 @@ def show(self, pokaz_entry):
677671
i.strip(),
678672
average(self.db.get_list_all(self.bd_dict[i.strip()])),
679673
)
680-
elif cb['text'] == "Мінімальне значення":
674+
elif cb["text"] == "Мінімальне значення":
681675
res = pokaz_entry.get().split(",")
682676
for i in res:
683677
self.show_histo(
@@ -688,7 +682,7 @@ def show(self, pokaz_entry):
688682
i.strip(),
689683
minimal(self.db.get_list_all(self.bd_dict[i.strip()])),
690684
)
691-
elif cb['text'] == "Максимальне значення":
685+
elif cb["text"] == "Максимальне значення":
692686
res = pokaz_entry.get().split(",")
693687
for i in res:
694688
self.show_histo(
@@ -699,7 +693,7 @@ def show(self, pokaz_entry):
699693
i.strip(),
700694
maximal(self.db.get_list_all(self.bd_dict[i.strip()])),
701695
)
702-
elif cb['text'] == "Середньоквадратичне відхилення по вибірці":
696+
elif cb["text"] == "Середньоквадратичне відхилення по вибірці":
703697
res = pokaz_entry.get().split(",")
704698
for i in res:
705699
self.show_histo(
@@ -708,9 +702,11 @@ def show(self, pokaz_entry):
708702
self.db.insert_deviation(
709703
len(self.db.get_list_all(self.bd_dict[i.strip()])),
710704
i.strip(),
711-
deviation(self.db.get_list_all(self.bd_dict[i.strip()])),
705+
deviation(
706+
self.db.get_list_all(self.bd_dict[i.strip()])
707+
),
712708
)
713-
elif cb['text'] == "Коефіцієнт варіації":
709+
elif cb["text"] == "Коефіцієнт варіації":
714710
res = pokaz_entry.get().split(",")
715711
for i in res:
716712
self.show_histo(
@@ -719,9 +715,11 @@ def show(self, pokaz_entry):
719715
self.db.insert_variation(
720716
len(self.db.get_list_all(self.bd_dict[i.strip()])),
721717
i.strip(),
722-
variation(self.db.get_list_all(self.bd_dict[i.strip()])),
718+
variation(
719+
self.db.get_list_all(self.bd_dict[i.strip()])
720+
),
723721
)
724-
elif cb['text'] == "Помилка середнього":
722+
elif cb["text"] == "Помилка середнього":
725723
res = pokaz_entry.get().split(",")
726724
for i in res:
727725
self.show_histo(
@@ -730,9 +728,11 @@ def show(self, pokaz_entry):
730728
self.db.insert_error(
731729
len(self.db.get_list_all(self.bd_dict[i.strip()])),
732730
i.strip(),
733-
std_error(self.db.get_list_all(self.bd_dict[i.strip()])),
731+
std_error(
732+
self.db.get_list_all(self.bd_dict[i.strip()])
733+
),
734734
)
735-
elif cb['text'] == "Коваріація":
735+
elif cb["text"] == "Коваріація":
736736
val = pokaz_entry.get().split(",")
737737
res = str(val[0]) + " " + str(val[1])
738738
self.cor_graph(
@@ -748,7 +748,7 @@ def show(self, pokaz_entry):
748748
self.db.get_list_all(self.bd_dict[val[1].strip()]),
749749
),
750750
)
751-
elif cb['text'] == "Коефіцієнт кореляції Пірсона":
751+
elif cb["text"] == "Коефіцієнт кореляції Пірсона":
752752
val = pokaz_entry.get().split(",")
753753
res = str(val[0]) + " " + str(val[1])
754754
self.cor_graph(
@@ -764,7 +764,7 @@ def show(self, pokaz_entry):
764764
self.db.get_list_all(self.bd_dict[val[1].strip()]),
765765
),
766766
)
767-
elif cb['text'] == "Т-критерий Стюдента":
767+
elif cb["text"] == "Т-критерий Стюдента":
768768
val = pokaz_entry.get().split(",")
769769
res = str(val[0]) + " " + str(val[1])
770770
self.cor_graph(
@@ -820,4 +820,4 @@ def start(self):
820820
Prog.window.mainloop()
821821

822822

823-
p = Prog()
823+
p = Prog()

0 commit comments

Comments
 (0)