Created
September 18, 2022 15:05
-
-
Save lesutton/0d3080c93376db50e4c2aae83930b9fa to your computer and use it in GitHub Desktop.
Python Statistic Examples
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import pandas as pd | |
import numpy as np | |
df = pd.DataFrame(data =[7, 16, 12, 51, 10, 81, 1, 16, 9, 11, 16]) | |
list = [7, 16, 12, 51, 10, 81, 1, 16, 9, 11, 16] | |
data = np.array([14, 19, 20, 22, 24, 26, 27, 30, 30, 31, 36, 38, 44, 47]) | |
q3, q1 = np.percentile(data, [75 ,25]) | |
iqr = q3 - q1 | |
list.sort() | |
print(list) | |
mean = df.mean() | |
mode = df.mode() | |
median = df.mean() | |
print("mean: ", mean) | |
print("mode: ", mode.values) | |
print("median: ", int(median)) | |
print("irq: ", int(iqr)) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment