MLassignment 2
MLassignment 2
import numpy as np
import matplotlib.pyplot as plt
import seaborn as sns
df = pd.read_csv(r"C:\Users\TANUR\Downloads\ml_1 - ml_1.csv")
df.head()
0 1 2.63 8.88
1 2 1.87 8.99
2 3 2.46 3.95
3 4 1.82 4.36
4 5 2.14 7.00
#QUES 1 (A)-> Draw and compare histograms of these two groups of tumor data (Data1(LG) and Data2(HG)).
#QUES 1 (B)-> Compare box and whisker plots of these two groups of data.
<Axes: >
#The box plot for LG tumors shows a smaller range with fewer outliers, indicating lower variability in tumor sizes.
#The box plot for HG tumors, on the other hand, displays a wider range, highlighting greater variability in the sizes
Sorted list in ascending order: [2, 2, 15, 17, 18, 19, 45, 67, 97, 105]
Mean: 38.7
# (ii) Median
median_value = np.median(user_list)
print("Median:", median_value)
Median: 18.5
# (iii) Mode
try:
mode_value = stats.mode(user_list)
print("Mode:", mode_value)
except stats.StatisticsError:
print("No mode found, all values appear only once.")
Mode: 2.0
# (iv) Variance
variance_value = np.var(user_list)
print("Variance:", variance_value)
Variance: 1317.81