Mine 3
Mine 3
ROLL NO : 12212161
Question 1:
STEPS TO BE FOLLOWED :-
let's start with generating a dataset of 50 random age values between 5 and 95 and perform each
computation step-by-step. We can then repeat the experiments as requested.
import numpy as np
import pandas as pd
from scipy import stats
data_sorted = np.sort(dataset)
mean = np.mean(data_sorted)
median = np.median(data_sorted)
mode = stats.mode(data_sorted)[0][0]
# (c) Compute percentile of a data item from the formed dataset (e.g., 25th percentile)
percentile_70th = percentile_70
percentile_80th = percentile_80
# (h) Find 1st and 3rd quartiles of the dataset (same as above)
quartile_1st = quartile_1
quartile_3rd = quartile_3
five_number_summary = {
"Minimum": np.min(data_sorted),
"Median": median,
"Maximum": np.max(data_sorted)
"Mean": mean,
"Median": median,
"Mode": mode,
"Midrange": midrange,
}
OUTPUT :
Result
6,
7,
7,
8,
11,
19,
19,
22,
25,
25,
25,
26,
26,
28,
34,
37,
42,
43,
46,
51,
53,
55,
55,
56,
57,
59,
62,
63,
64,
64,
65,
66,
66,
66,
68,
68,
76,
77,
79,
79,
80,
84,
87,
91,
92,
92,
93,
93,
95],
'Mean': 52.36,
'Median': 56.5,
'Mode': 25,
'Midrange': 50.5,
'Median': 56.5,
'Maximum': 95}}
2)creating a general program to compute the percentile of a given dataset based on user input.
INPUT CODE :
def compute_percentile():
return percentile_result