DataAnalytics_July_2026
Age = [33,31,24,45,34,29,37,40]
Weight = [70,71,65,66,77,68,66,69]
import matplotlib.pyplot as plt
Age = [33,31,24,45,34,29,37,40]
Weight = [70,71,65,66,77,68,66,69]
plt.bar(Age,Weight)
plt.xlabel('Age')
plt.ylabel('Weight')
plt.title('Age vs Weight')
plt.show()
plt.scatter(Age,Weight)
plt.xlabel('Age')
plt.ylabel('Weight')
plt.title('Age vs Weight')
plt.show()
Given the following dataset:
[12,15,18,20,22,24,25,27,30,35]
import matplotlib.pyplot as plt
import numpy as np
data = [12,15,18,20,22,24,25,27,30,35]
quantile = np.quantile(data,[0.25,0.5,0.75])
print(quantile)
plt.boxplot(data)
plt.title('Distribution of Quantiles')
plt.show()
Using K-Means clustering (K = 2), identify the possible outlier(s) in the following dataset:
Weight = {70,71,65,66,77,68,66,69,91,50,55}
Show the cluster assignments and explain why the identified value(s) can be considered outlier(s).
The following data represent three groups.
A = {22,23,42,14,15,16}
B = {30,44,35,19,21,18}
C = {34,35,45,29,28,19}
Use one-way ANOVA to determine whether the mean values of the three groups differ significantly. State the null hypothesis, calculate the F-statistic (or use Python), and interpret the result.
import scipy.stats as stats
# Perform the One-Way ANOVA
A = [22,23,42,14,15,16]
B = [30,44,35,19,21,18]
C = [34,35,45,29,28,19]
f_stat, p_val = stats.f_oneway(A, B, C)
print(f"F-Statistic: {f_stat:.4f}")
print(f"p-value: {p_val:.4f}")
5. Given the following dataset:
Month = {"Jan","Feb","Mar","Apr","May","Jun"}
Sales = {120,150,135,170,165,180}
import matplotlib.pyplot as plt
Month = ["Jan","Feb","Mar","Apr","May","Jun"]
Sales = [120,150,235,170,165,180]
plt.bar(Month,Sales)
plt.xlabel('Month')
plt.ylabel('Sales')
plt.title('Sales vs Month')
plt.show()
plt.plot(Month,Sales)
plt.xlabel('Month')
plt.ylabel('Sales')
plt.title('Sales vs Month')
plt.show()
maxsales = np.max(Sales)
index = 0
for x in Sales:
if x == maxsales:
break
else:
index += 1
print(f"Max sales: {maxsales} is in month {Month[index]}")
Given the following dataset:
Height = {150,155,160,162,168,170,175,180}
Weight = {48,52,56,58,62,65,70,75}
The following data represent students' marks. Marks = {55,60,65,70,75,80,85,90} Create:
Given
Data={12,18,25,20,17,30,24,18,19,22}
Calculate
import numpy as np
Data=[12,18,25,20,17,30,24,18,19,22]
mean = np.mean(Data)
median = np.median(Data)
std = np.std(Data)
print(f'mean: {mean}')
print(f'median: {median}')
print(f'std: {std}')
Using the following dataset,
Age={22,25,26,28,30,31,35,38,40,45}
Find
import numpy as np
Age=[22,25,26,28,30,31,35,38,40,45]
min = np.min(Age)
max = np.max(Age)
range = np.max(Age)-np.min(Age)
var = np.var(Age)
print("min:",min)
print("max:",max)
print("range:",range)
print("var:",var)
Given Data={8,10,12,14,15,18,20,22,25}
Calculate
import matplotlib.pyplot as plt import numpy as np Data=[8,10,12,14,15,18,20,22,25] quartiles = np.percentile(Data,[25,50,75]) print(quartiles) plt.boxplot(Data) plt.show()
Given: Age={22,None,25,30,None,27,35}
Write a Python program to
Age=[22,None,25,30,None,27,35]
df = pd.DataFrame(Age,columns=['Age'])
missing_count = df.isnull().sum()
print(f"Missing values: {missing_count}")
df.fillna(df.mean(),inplace=True)
print(df)
Given: Hours={2,3,4,5,6,7,8}
Marks={40,45,55,60,68,75,82}
Hours=[3,4,5,6,7,8,9]
Marks=[40,45,55,60,68,75,82]
plt.scatter(Hours,Marks)
plt.xlabel('Hours')
plt.ylabel('Marks')
plt.title('Hours vs Marks')
plt.show()
corrcoef = np.corrcoef(Hours,Marks)
print(f"Corrcoef: {corrcoef[0,1]}")
Given:
Temperature={18,20,22,24,26,28}
IceCreamSales={80,90,110,125,140,155}
Calculate the correlation between the two variables and interpret the result.
Temperature=[18,20,22,24,26,28]
IceCreamSales=[80,90,110,125,140,155]
corrcoef = np.corrcoef(Temperature,IceCreamSales)
print(f"Corrcoef: {corrcoef[0,1]}")
if corrcoef[0,1] > 0.5:
print("Correlated")
else:
print("Not Correlated")