0% found this document useful (0 votes)
5 views2 pages

DS Tut6

Data science tutorial -6 pdf For Mumbai University

Uploaded by

VIDIT SHAH
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5 views2 pages

DS Tut6

Data science tutorial -6 pdf For Mumbai University

Uploaded by

VIDIT SHAH
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

MTech Computer Engineering Semester I

Tutorial 6
Data Science
Problem statement:
Find Stem-Leaf plot for the following data and provide the key to interpret the plot.
8.6, 2.5, 9.5, 7.3, 8.4, 2.1, 9, 2.5, 6.7, 7.1, 2.5, 9.4, 8.2, 2.1, 8.4, 7.5, 2.8, 7.2. 2.2

Find Box plot for the following data and provide the key to interpret the plot.
23, 67, 62, 52, 23, 25, 33, 55, 58, 44, 33, 32, 29, 39, 31, 55, 66, 45, 41, 43, 36, 43, 41, 41, 62
Find the minimum, maximum, first quartile, third quartile and median values from the plot.

Implement program for any one of the above.

Flow chart/pseudo code:


2.
Code:
import matplotlib.pyplot as plt
import numpy as np

# Data
data = [23, 67, 62, 52, 23, 25, 33, 55, 58, 44, 33, 32, 29, 39, 31, 55, 66, 45, 41, 43, 36, 43, 41, 41,
62]

# Calculating key statistics


minimum = np.min(data)
maximum = np.max(data)
q1 = np.percentile(data, 25)
median = np.percentile(data, 50)
q3 = np.percentile(data, 75)

# Creating the box plot


plt.figure(figsize=(8, 6))
plt.boxplot(data, vert=False, patch_artist=True, boxprops=dict(facecolor='skyblue', color='black'),
medianprops=dict(color='red'), whiskerprops=dict(color='black'), capprops=dict(color='black'))
plt.title('Box Plot of the Data')
plt.xlabel('Values')
plt.grid(True, axis='x', linestyle='--', alpha=0.7)

plt.show()

print("Minimum = ", minimum)


print("Maximum = ", maximum)
print("q1 = ", q1)
print("Median = ", median)
print("q3 = ", q3)

Results:

Results Analysis:
The box plot analysis shows a moderate spread in the data, with values ranging from 23 to 67.
The interquartile range (IQR), which is from 33.0 to 55.0, captures the middle 50% of the
values, indicating that most of the data points are concentrated around the median of 41.0.

The relatively symmetrical placement of the median within the box suggests a somewhat
balanced distribution, with no significant skew. The whiskers extend to both the minimum (23)
and maximum (67) without any outliers, indicating that there are no unusually extreme values
in this dataset.

Overall, the data shows a fairly even spread around the center, with the majority of values
clustering between 33 and 55.

You might also like