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

Dev Lab Manual

The document is a lab manual for the Data Exploration and Visualization Laboratory course at SRI Venkateswara College of Technology. It outlines the course objectives, a list of experiments, and expected outcomes for students, focusing on data analysis and visualization techniques using tools like Python, R, and Tableau. Each experiment includes aims, algorithms, and example programs to guide students through practical applications of data exploration and visualization.

Uploaded by

dd.dharshini2006
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 views26 pages

Dev Lab Manual

The document is a lab manual for the Data Exploration and Visualization Laboratory course at SRI Venkateswara College of Technology. It outlines the course objectives, a list of experiments, and expected outcomes for students, focusing on data analysis and visualization techniques using tools like Python, R, and Tableau. Each experiment includes aims, algorithms, and example programs to guide students through practical applications of data exploration and visualization.

Uploaded by

dd.dharshini2006
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

SRI VENKATESWARAA

COLLEGE OF TECHNOLOGY
VADAKKAL, SRIPERUMBUDUR - 602105

(AN AUTONOMOUS INSTITUTION, AFFILIATED TO ANNA UNIVERSITY, CHENNAI)

LAB MANUAL

DEPARTMENT :

SUBJECT CODE :

SUBJECT NAME :

YEAR/SEM :
SRI VENKATESWARAA COLLEGE OF TECHNOLOGY
Vadakal Village, Pondur Post, Sriperumbudur 602 105

BONAFIDE CERTIFICATE

Certified that this is the bonafide record work of


Register No. of FOURTH Semester, AD3301 DATA
EXPLORATION AND VISUALIZATION LABORATORY ________________during
the academic year 2025– 2026.

STAFF INCHARGE HEAD OF THE DEPARTMENT

Submitted for the practical examination of B.E / [Link] held at

SRI VENKATESWARAA COLLEGE OF TECHNOLOGY on

INTERNAL EXAMINER EXTERNAL EXAMINER


SYLLABUS

OBJECTIVES:

 To outline an overview of exploratory data analysis.


 To implement data visualization using Matplotlib.
 To perform univariate data exploration and analysis.
 To apply bivariate data exploration and analysis.
 To use Data exploration and visualization techniques for multivariate and time series data

LIST OF EXPERIMENTS:

1. Install the data Analysis and Visualization tool: R/ Python /Tableau Public/ Power BI

2. Perform exploratory data analysis (EDA) on with datasets like email data set. Export all your
emails as a dataset, import them inside a pandas data frame, visualize them and get different insights
from the data.

3. Working with Numpy arrays, Pandas data frames , Basic plots using Matplotlib.

4. Explore various variable and row filters in R for cleaning data. Apply various plot features in R on
sample data sets and visualize.

5. Perform Time Series Analysis and apply the various visualization techniques.

6. Perform Data Analysis and representation on a Map using various Map data sets with Mouse
Rollover effect, user interaction, etc..

7. Build cartographic visualization for multiple datasets involving various countries of the world;
states and districts in India etc.

8. Perform EDA on Wine Quality Data Set.

9. Use a case study on a data set and apply the various EDA and visualization techniques and present
an analysis report.

COURSE OUTCOMES:

At the end of this course, the students will be able to:

CO1: Understand the fundamentals of exploratory data analysis.

CO2: Implement the data visualization using Matplotlib.

CO3: Perform univariate data exploration and analysis.

CO4: Apply bivariate data exploration and analysis.

CO5: Use Data exploration and visualization techniques for multivariate and time series data
INDEX

[Link] Date Name Of The Experiment Page Mark Staff Sign


01 Install the data Analysis and Visualization tool: R/
Python /Tableau Public/ Power BI

02 Perform exploratory data analysis (EDA) on with


datasets like email data set. Export all your
emails as a dataset, import them inside a pandas
data frame, visualize them and get different
insights from the data.

03 Working with Numpy arrays, Pandas data frames


, Basic plots using Matplotlib.
04 Explore various variable and row filters in R for
cleaning data. Apply various plot features in R on
sample data sets and visualize.

05 Perform Time Series Analysis and apply the


various visualization techniques.

06 Perform Data Analysis and representation on a


Map using various Map data sets with Mouse
Rollover effect, user interaction, etc..

07 Build cartographic visualization for multiple


datasets involving various countries of the world;
states and districts in India etc.
08 Perform EDA on Wine Quality Data Set.
09 Use a case study on a data set and apply the
various EDA and visualization techniques and
present an analysis report.
01. Install the data Analysis and Visualization tool: R/ Python /Tableau Public Power BI.

AIM:

The aim is to install the data analysis and visualization tool

ALGORITHM:

1. Open [Link] in your web browser.

2. Download the Anaconda Python 3 installer for Windows.

3. Double-click the executable and install Python 3 using the recommended settings. Make sure
that Register Anaconda as my default Python 3.x option is checked – it should be in the latest
version of Anaconda.

4. Verify the installation: click Start, search and select Anaconda Prompt from the menu. A window
should pop up where you can now type commands such as checking your Conda installation

Program 1:

#importing the pands package

import pandas as pd

# creating rows

hafeez=['Hafeez, 19]

aslan=['Aslan', 21]

kareem = ['Kareem', 18]

#pass those Series to the DataFrame

#passing columns as well data_frame = [Link]([hafeez, aslan, karcem], columns=['Name',


'Age'])

#displaying the DataFrame

print(data_frame)

Output:

If you run the above program, you will get the following results.

Name Age

0 Hafeez 19

1 Aslan 21

2 Kareem 18
Program 2:

#importing the pyplot module to create graphs

import [Link] as plot

#importing the data using pd.read_csv() method

data=pd.read_csv('[Link]’)

#creating a histogram of Time period

data['Time period').hist(bins = 10)

Output:

If you run the above program, you will get the following results.

<[Link] subplots AxesSubplot at Ox25e363ca880>

RESULT:

Data analysis and visualization tool is installed successfully


02. Perform exploratory data analysis (EDA) on with datasets like email data set.
Export all your emails as a dataset, import them inside a pandas data frame, visualize
them and get different insights from the data.

AIM:

The aim is to Perform exploratory data analysis (EDA) on with datasets like email data set. Export
all your emails as a dataset, import them inside a pandas data frame, visualize them and get
different insights from the data.

ALGOITHM:

Step 1: create a csv file with only the required attributes.

Step 2: define plot number per hour per day

Step 3: visualize using histogram

Step 4: print the output

PROGRAM:

Create a CSV file with only the required attributes:

with open('[Link], w) as outputfile:

writer=[Link](outputfile)

[Link](['subject', 'from', 'date', 'to', 'label', 'thread'])

for message in mbox:

[Link]([

message['from"],

message['subject'],

message['date'],

message[to]

message X-Gmail-Labels),

message('X-GM-THRID

The output of the preceding code is as follows:

subject object

from object date

object
to object label

object

thread float64

dtype: object

def plot_number_perdhour_per_year(df, ax, label=None, dt-1, smooth=False,

weight_fun None, **plot_kwargs):

tod=df[df['timeofday'].notna0]['timeofday').values year-

df[dff'year'].notna0]['year'].values

Ty= [Link]() - year min0) T

=[Link]()-[Link]() bins =

int(T/dt)

if weight fun is None:

weights-1/(np.ones_like(tod) Ty 365.25/dt) else:

weights weight_fun(df) if

smooth:

hst, [Link](tod, bins-bins, weights weights); x=

[Link](xedges, -1)+0.5 (xedges[1]-xedges[0])

hst-ndimage.gaussian_filter(hst, sigma-0.75) f-

interp 1d(x, hst, kind-cubic) x= [Link]([Link](), x.max0,10000) hst=

f(x)

[Link](x, hst, label-label, plot_kwargs) else:

[Link](tod, bins-bins, weights-weights, label-label,

**plot_kwargs):

[Link](Is=’:’, color=’k’)

orientation = plot_kwargs.get('orientation)

if orientation is None or orientation="vertical":


[Link] xlim(0.

[Link].set_major locator MaxNLocator(8))

ax.set_xticklabels([[Link](str(int([Link](ts, 24))),

%H").strftime("%1" %p")

for ts in ax.get_xticks()]); elif

orientation="horizontal":

ax.set_ylim(0,

ax:yaxis.set_major_locator(MaxNLocator(8))

ax.set_yticklabels([[Link](str(int([Link](ts, 24))),

"%H").strftime("%I%P"))

For ts in ax.get_yticks()]);

OUTPUT:
RESULT:

Exploratory data analysis on with datasets like email data set has been performed successfully.
03. WORKING WITH NUMPY ARRAYS, PANDAS DATA FRAMES , BASIC PLOTS USING
MATPLOTLIB

AIM:

To perform the program with numpy arrays, pandas data frames, basic plots using
matplotlib.

ALGORITHM:

Step 1: import numpy, matplotlib libraries

Step 2: set x and y value

Step 3: give title, x lable, y label

Step 4: plot x and y

Step 5: show the plot

PROGRAM 1

import numpy as np

from matplotlib import pyplot as plt

x= [Link](1,11)

y=2x+5

[Link]("Matplotlib demo")

[Link]("x axis caption")

[Link]("y axis caption")

[Link](x,y)

[Link]()

OUTPUT:
PROGRAM 2

import pandas as pd

import [Link] as plt

# creating a DataFrame with 2 columns

dataFrame = [Link](

"Car": *"BMW', 'Lexus', 'Audi', 'Mustang', 'Bentley’, ‘Jaguar’+,

“Reg_Price”: *2000,2500,2800,3000,3200,3500+

"Units": [100, 120, 150, 170, 180, 2001]

# plot a line graph

[Link](dataFrame("Reg_Price"], dataFrame["Units"])

[Link]()

OUTPUT:

RESULT:

Numpy arrays, pandas data frames, basic plots using Matplotlib are established.
04. Explore various variable and row filters in R for cleaning data. Apply various plot
features in R on sample data sets and visualize.

AIM:

To perform row filters in R for cleaning data and visualize through the plots.

ALGORITHM:

Step 1: install [Link] package

Step 2: load [Link]

Step 3: create [Link]

Step 4: filter row by column values

Step 5: set rows where x is February

Step 6: filter row by multiple column values

Step 7: set rows where x is February and y is 1

Step 8: stop

PROGRAM:

#Install [Link] package

[Link]("[Link]")

#Load [Link]

library("[Link]")

We also create some example data.

dt all <- [Link](x = rep([Link][1:3], each = 3),

y = rep(c(1, 2, 3), times = 3),

z=rep(c(TRUE, FALSE, TRUE), each = 3)) # Create [Link]

head(dt_all)
OUTPUT:

Filter Rows by Column Values

In this example, I'll demonstrate how to select all those rows of the example data for which column x
is equal to February. With the use of %in%, we can choose a set of values of x. In this example, the
set only contains one value.

dt_all[x %in% [Link][c(2)], ]

OUTPUT:

Filter Rows by Multiple Column Value

In the previous example, we addressed those rows of the example data for which one column was
equal to some value. In this example, we condition on the values of multiple columns.

dt_all[x %in% [Link][c(2)] & y=1,] # Rows, where x is February and y is 1

OUTPUT:

RESULT:

Various variable and row filters in R for cleaning data is explored. Various plot features in R on
sample data sets and visualize is applied.
05. Perform Time Series Analysis and apply the various visualization techniques.

Aim:

To analyse time series and apply the various visualization techniques.

ALGORITHM:

Step 1: start

Step 2:import matplotlib, seaborn, numpy, pandas labraries.

Step 3: read the CSV file

Step 4:draw plot

Step 5: stop

PROGRAM:

import matplotlib as mpl

import [Link] as plt

import seaborn as sns

import numpy as np

import pandas as pd

[Link]({'[Link]': (10, 7), '[Link]': 120})

#Import as Dataframe

df-pd.read_csv('[Link]
irse_dates=['date'])

[Link]()

OUTPUT:
#Time series data source: fpp pacakge in R.

import [Link] as plt df-


pd.read_csv('[Link]
parse_dates=['date'], index_col='date')

#Draw Plot

def plot_df(df, x, y, title="", xlabel='Date', ylabel='Value', dpi=100):

[Link](figsize (16,5), dpi=dpi)

[Link](x,y,color=’tab:red’)

[Link]().set(title title, xlabel=xlabel, ylabel=ylabel)

[Link]()

plot_df(df, x=[Link], y=[Link], title="Monthly anti-diabetic drug sales in Australia from 1992
to 2008.")

OUTPUT:

RESULT:

Thus Time series analysis is performed and the various visualization techniques are applied
6. Perform Data Analysis and representation on a Map using various Map data sets with
Mouse Rollover effect, user interaction, etc..

AIM:

To Perform Data Analysis on a Map using various Map data sets with Mouse Rollover effect, user
interaction, etc.

ALGORITHM:

Step 1: start

Step 2: draw the map background

Step 3: scatter city data with colour reflecting population

Step 4:create colorbar and legend

Step 5: make legends with dummies points

Step 6: stop

PROGRAM:

#1. Draw the map background

fig= [Link](figsize=(8,8))

m= Basemap(projection='lcc', resolution='h',

lat_0-37.5, lon_0=-119,

width=1E6, height=1.2E6)

[Link]()

[Link](color='gray')

[Link](color='gray')"

[Link](color='gray')

#2. scatter city data, with color reflecting population

# and size reflecting area

[Link](lon, lat, latlon=True,

c-np.log10(population), s-area,

cmap='Reds', alpha=0.5)

#3. create colorbar and legend


[Link](label=r'$\log_{10} ({\rm population})$’)

[Link](3, 7)

# make legend with dummy points

for a in [100, 300, 500]:

[Link]([], [], c='k', alpha=0.5, s=a,

label=str(a)+'km$^2$")

[Link](scatterpoints=1, frameon=False,

labelspacing=1, loc='lower left');

OUTPUT:

RESULT:

Data Analysis and representation on a Map using various Map data sets with Mouse Rollover effect,
user interaction are performed.
07. Build cartographic visualisation for multiple datasets involving various countries of the
world.

AIM:

To build cartographic visualisation for multiple datasets involving various countries of the
world.

ALGORITHM:

Step 1: start the program

Step 2: import matplotlib, numpy

Step 3: create color bar using markers and specify the properties of the plots.

Step 4: draw the plot

Step 5: stop

Program:

[Link](zipcodes).transform_filter(

‘ -150<[Link] && 22 < [Link] && [Link] <55'

).transform_calculate(

digit 'datum.zip_code[0]'

).mark_line(

stroke Width = 0.5

).encode(

longitude"longitude:Q,

latitude="latitude:Q,

order =zip code:O'

color="digit:N",

).project(

type='albersUsa’

).properties(

width=900,

height =500
).configure_view(

stroke =None

OUTPUT:

[Link](

[Link](alt.topo_feature(usa, 'states')).mark_geoshape(

fill="#ddd', stroke="#fff", strokeWidth=1

),

[Link](airports).mark_circle(size=9).encode(

latitude="latitude:Q,

longitude="longitude:Q',

tooltip="iata:N'

).project(

type='albersUsa'

)properties(

width=900,

height= 500

).configure_view(

Stroke= None

)
OUTPUT:

RESULT:

Thus cartographic visualisation for multiple datasets involving various countries of the world is
builded.
08. Perform EDA on Wine Quality Data Set.

AIM:

To perform EDA on wine quality data set.

ALGORITHM:

Step 1: import pandas, NumPy, seaborn, matplotlib, sklearn, xgboost libraries.


Step 2: Look at first five rows of the dataset.
Step3: Explore the type of data present in each of the columns present in the dataset.
Step 4: Explore the descriptive statistical measures of the dataset.
Step 5: Check the number of null values in the dataset columns wise.
Step 6: Impute the missing values by means as the data present in the different columns are
continuous values.
Step 7: Draw the histogram to visualise the distribution of the data with continuous values
in the columns of the dataset.
Step 8: Draw the count plot to visualise the number data for each quality of wine.
Step 9: From the heat map we can find the ‘total sulphur dioxide’ and ‘free sulphur
dioxide‘ are highly correlated features so, we will remove them.
Step 10: Model development
Step 11: Prepare our data for training and splitting it into training and validation data.
Step 12: Normalising the data before training
Step 13: Model evaluation.
Step 14: Print the classification report for the best performing model.

PROGRAM:
#importing libraries

import numpy as np

import pandas as pd

[Link] as plt

import seaborn as sns

%matplotlib inline

ln:4

#features in data

[Link]

out:[4]

Index(['fixed acidity', volatile acidity', 'citric acid', 'residual sugar', ;chlorides',

'free sulfur dioxide', total sulfur dioxide', 'den sity', 'pH', 'sulphates',

'alcohol', 'quality'],
dtype="object")

RESULT:

Thus EDA in Wine Quality Dataset is performed


9. Use a case study on a data set and apply the various EDA and visualization
techniques and present an analysis report.
AIM:

Use a case study on a dataset and apply the various EDA and visualization techniques and
present an analysis report.

ALGORITHM:

Step 1: import pandas, NumPy, seaborn, matplotlib libraries.


Step 2: Perform univariate analysis
Step3: Use pie chart for visualizing Categorical data.
Step 4: Use distplot, histogram, for visualizing numerical data
Step 5: Perform bivariate analysis/multivariate analysis.
Step 6: Explore the plots using scatter plot when both the variable is numerical.
Step 7: Explore the plots using bar plot, box plot, dist plot for visualizing, if one variable is
numerical and one is categorical.
Step 8: Explore the plots using heat map, cluster map, for visualizing categorical and
categorical columns

PROGRAM:

import datetime

import math

import pandas as pd

import random

import radar

from faker import Faker

fake = Faker()

def generateData(n):

listdata = []

start [Link](2019, 8, 1)

end = [Link](2019, 8, 30)

delta = end-start

for_ in range(n):

date= radar.random_datetime(start="2019-08-1'. Stop=’2019-08-30').strftime("%Y-%m-%d")


price= round([Link](900,1000),4)

[Link]([date, price])

df=[Link](listdata, columns = ['Date', 'Price']) df['Date'] = pd.to_datetime(df['Date'],


format="%Y-%m-%d') df=

[Link](by='Date').mean()

import [Link] as plt

[Link]['[Link]'] = (14, 10)

[Link](df)
OUTPUT:

RESULT:

Analysis report of the dataset is performed successfully.

You might also like