art-bashkirev commited on
Commit
9f9efe3
·
1 Parent(s): eecb42d

feat: MDFile generation

Browse files
Files changed (1) hide show
  1. app.py +3 -4
app.py CHANGED
@@ -19,6 +19,7 @@ def make_all(numbers) -> dict:
19
  rng = np.max(arr) - np.min(arr)
20
  vrnc = np.var(arr)
21
 
 
22
  vrncls = [
23
  [f"{n}", f"{(mean - n):.2f}", f"{(mean - n) ** 2:.2f}"]
24
  for n in sorted(arr)
@@ -26,20 +27,18 @@ def make_all(numbers) -> dict:
26
 
27
  mdFile = MdUtils(file_name='Практическая работа по статистике',
28
  title='Практическая работа по статистике')
29
-
30
  mdFile.new_line()
31
  mdFile.new_paragraph(",".join([str(x) for x in arr]))
32
  mdFile.new_line()
33
  mdFile.new_paragraph(",".join([str(x) for x in sorted(arr)]))
34
  mdFile.new_line()
35
- mdFile.new_paragraph(f"Размах: {(np.max(arr) - np.min(arr))}")
36
  mdFile.new_line()
37
  mdFile.new_paragraph(f"Мода: {', '.join([str(unique[i]) for i in np.argwhere(counts == np.max(counts)).flatten().tolist()])}")
38
  mdFile.new_line()
39
  mdFile.new_paragraph(f"А ср.: {mean:.2f}")
40
  mdFile.new_line()
41
  mdFile.new_paragraph(f"D = {vrnc:.2f}")
42
-
43
  list_of_strings = ["Элемент"]
44
 
45
  for x in d:
@@ -54,7 +53,7 @@ def make_all(numbers) -> dict:
54
  mdFile.new_table(columns=len(d)+1, rows=2, text=list_of_strings, text_align='center')
55
  mdFile.create_md_file()
56
 
57
- with open("Практическая работа по статистике.md", encoding="utf-8") as f:
58
  mdfile_enc = base64.b64encode(f.read())
59
 
60
  return {
 
19
  rng = np.max(arr) - np.min(arr)
20
  vrnc = np.var(arr)
21
 
22
+ # Detailed Variance
23
  vrncls = [
24
  [f"{n}", f"{(mean - n):.2f}", f"{(mean - n) ** 2:.2f}"]
25
  for n in sorted(arr)
 
27
 
28
  mdFile = MdUtils(file_name='Практическая работа по статистике',
29
  title='Практическая работа по статистике')
 
30
  mdFile.new_line()
31
  mdFile.new_paragraph(",".join([str(x) for x in arr]))
32
  mdFile.new_line()
33
  mdFile.new_paragraph(",".join([str(x) for x in sorted(arr)]))
34
  mdFile.new_line()
35
+ mdFile.new_paragraph(f"Размах: {rng}")
36
  mdFile.new_line()
37
  mdFile.new_paragraph(f"Мода: {', '.join([str(unique[i]) for i in np.argwhere(counts == np.max(counts)).flatten().tolist()])}")
38
  mdFile.new_line()
39
  mdFile.new_paragraph(f"А ср.: {mean:.2f}")
40
  mdFile.new_line()
41
  mdFile.new_paragraph(f"D = {vrnc:.2f}")
 
42
  list_of_strings = ["Элемент"]
43
 
44
  for x in d:
 
53
  mdFile.new_table(columns=len(d)+1, rows=2, text=list_of_strings, text_align='center')
54
  mdFile.create_md_file()
55
 
56
+ with open("Практическая работа по статистике.md", "rb", encoding="utf-8") as f:
57
  mdfile_enc = base64.b64encode(f.read())
58
 
59
  return {