Skip to content

Commit

Permalink
add calculus
Browse files Browse the repository at this point in the history
  • Loading branch information
DGrothe-PhD committed May 15, 2024
1 parent d1c69ed commit 2fe8898
Show file tree
Hide file tree
Showing 2 changed files with 443 additions and 0 deletions.
38 changes: 38 additions & 0 deletions Mathematics/StatisticCalc.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
#!/usr/bin/python
import statistics as stats
import numpy as np
from py_markdown_table.markdown_table import markdown_table

example_data = [43.07, 39.23, 44.76, 42.15, 39.98, 40.5, 46.08, 38.62]

def EvaluateQuantiles(data_list, name = ""):
# Sort first
original_data = data_list
data_list.sort()
sorted_data = data_list
print("sorted .... : ", sorted_data)
#
# Calculate quartiles
Q1 = np.percentile(original_data, 25)
Median = np.percentile(original_data, 50)
Q3 = np.percentile(original_data, 75)
Avg = stats.mean(original_data)
#
# Table
results = [
{
"Name": name,
"Minimum" : sorted_data[0],
"Q1" : Q1,
"Median" : Median,
"Q3": Q3,
"Maximum" : sorted_data[-1],
"Average" : Avg
}
]
markdown = markdown_table(results).get_markdown()
print(markdown)

# Example

EvaluateQuantiles(example_data, "Beispiel")
Loading

0 comments on commit 2fe8898

Please sign in to comment.