Online-Academy
Look, Read, Understand, Apply

Data Analytics

DataAnalytics_July_2026

Age = [33,31,24,45,34,29,37,40]
Weight = [70,71,65,66,77,68,66,69]

  1. Draw a bar chart of Age.
  2. Draw a scatter plot showing the relationship between Age and Weight.
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]

  1. Calculate Q1, Q2 (Median), and Q3.
  2. Draw the boxplot.
  3. Identify whether any outlier exists.
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}
  1. Draw a bar chart.
  2. Draw a line chart.
  3. Which month has the highest sales?

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}
  1. Draw a scatter plot.
  2. Comment on the relationship between height and weight.

The following data represent students' marks. Marks = {55,60,65,70,75,80,85,90} Create:

  1. Histogram
  2. Boxplot
  3. Interpret the distribution.


Given Data={12,18,25,20,17,30,24,18,19,22}
Calculate

  1. Mean
  2. Median
  3. Standard Deviation
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

  1. Minimum
  2. Maximum
  3. Range
  4. Variance
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

  1. Q1
  2. Q2
  3. Q3
  4. Draw the boxplot.
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

  1. Detect missing values.
  2. Replace missing values with the mean age.
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}
  1. Draw a scatter plot.
  2. Calculate the correlation coefficient.
  3. Interpret the result.
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")