[go: up one dir, main page]

0% found this document useful (0 votes)
2 views3 pages

2.to Acquire, Visualize and Analyze The Data Set

The document outlines a practical exercise for TE Mechanical students at MVPS’S KBT College of Engineering, focusing on data acquisition, visualization, and analysis using a sales and profit dataset over 25 years in CSV format. It includes objectives such as loading the dataset, plotting various types of graphs, and executing a Python program using libraries like Pandas and Matplotlib. The practical concludes with the use of different plots to analyze the dataset visually.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views3 pages

2.to Acquire, Visualize and Analyze The Data Set

The document outlines a practical exercise for TE Mechanical students at MVPS’S KBT College of Engineering, focusing on data acquisition, visualization, and analysis using a sales and profit dataset over 25 years in CSV format. It includes objectives such as loading the dataset, plotting various types of graphs, and executing a Python program using libraries like Pandas and Matplotlib. The practical concludes with the use of different plots to analyze the dataset visually.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

MVPS’S KBT College of Engineering Nashik-422013

Department of Mechanical Engineering


TE Mechanical Subject- 302049: Artificial Intelligence & Machine Learning

Practical No. 02

Aim: To acquire, visualize and analyze the data set.

Objectives:

1. To load a dataset and split data.


2. To plot different types of plot.
3. To learn how to execute a python program.

Package Used: - Python 3

Problem Definition:-
The data set is sales and profit data of company products for 25 years. The data is in CSV
format. The aim is to plot different types of plots to analyze the data visually.

Input data
1. Dataset given in form of .csv file (comma separated values)

Description of variables in the above file


Sr. No. Sales Profit
1. 261.96 41.9136
2. 731.94 219.582
3. 14.62 6.8714
4. 957.577 -383.031
5
5. 22.368 2.5164
6. 48.86 14.1694
7. 7.28 1.9656
8. 907.152 90.7152
9. 18.504 5.7825

Program:-

import numpy as np #required for mathematical calculation


import pandas as pd #required for vector and array
import matplotlib.pyplot as plt
import seaborn as sns
from seaborn import load_dataset

temp = pd.read_csv("SalesNProfit.csv")
print(temp)

Artificial Intelligence & Machine Learning Mechanical Engineering Department


MVPS’S KBT College of Engineering Nashik-422013
Department of Mechanical Engineering
TE Mechanical Subject- 302049: Artificial Intelligence & Machine Learning

Categorical Data
1) CountPlot
sns.countplot( data = temp)
plt.xlabel("X-axis")

plt.show()

2) Pie Chart
a=temp.loc[:,"Sales"]
month=['1','2','3','4','5','6','7','8','9']
# Creating plot
fig = plt.figure(figsize =(10, 10))
plt.pie(a[1:10],labels = month)

# show plot
plt.show()

Numerical Data
1) Scatter Plot
x = list(temp['Sales']) #temp is the data name
y = list(temp['Profit']) #temp is the data name
plt.scatter(x,y)
plt.show()

2) Box Plot

plt.boxplot(temp[1:23])
# show plot
plt.show()

Artificial Intelligence & Machine Learning Mechanical Engineering Department


MVPS’S KBT College of Engineering Nashik-422013
Department of Mechanical Engineering
TE Mechanical Subject- 302049: Artificial Intelligence & Machine Learning

3) Line plot
a=temp.loc[:,"Sales"]
x = list(a[:25])
y = range(25)
plt.xlabel("X-axis")
plt.ylabel("y-axis")
plt.legend('temp')
plt.title('The sales for first 25 years')
plt.plot(y,x)
plt.show()

Output:-

Figure 1 count plot Figure 2 Pie Chart

Figure 4 Line Chart


Figure 3 Scatter Plot

Conclusion:-

● In this practical different types of plot are used to analyze the data.

Artificial Intelligence & Machine Learning Mechanical Engineering Department

You might also like