0% found this document useful (0 votes)
8 views17 pages

Ad8311 Data Science Laboratory

Download as docx, pdf, or txt
Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1/ 17

AD8311 DATA SCIENCE LABORATORY

NAME : ABDUL RAUF


ENROLLMENT : 21BTE3CSE10002
YEAR/SEM : VI
SECTION : A
BRANCH : CSE

Abdul Rauf
21BTE3CSE100
CONTENTS

Sl. No. Name of the Experiment Page Experiment Staff


No. Date Signature

3
1 Working with Numpy arrays

6
2 Working with Pandas data frames

8
3 Develop python program for Basic plots using Matplotlib

13
4 Develop python program for Frequency distributions

14
5 Develop python program for Variability

Develop python program for Averages 16


6

18
7 Develop python program for Normal Curves

Develop python program for Correlation and scatter plots 20


8

Develop python program for Correlation coefficient 22


9

24
10 Develop python program for Simple Linear Regression

Abdul Rauf
21BTE3CSE100
Ex no: 1 Working with Numpy arrays

AIM

Working with Numpy arrays

ALGORITHM
Step1: Start
Step2: Import numpy module
Step3: Print the basic characteristics and operactions of array
Step4: Stop

PROGRAM

Program to Perform array Slicing

Result:
Thus the working with Numpy arrays was successfully completed.

Abdul Rauf
21BTE3CSE100
Ex no: 2 Create a dataframe using a list of

elements. Aim:

To work with Pandas data frames

ALGORITHM

Step1: Start
Step2: import numpy and pandas module
Step3: Create a dataframe using the
dictionary Step4: Print the output
Step5: Stop

PROGRAM

Result:
Thus the working with Pandas data frames was successfully completed.

Abdul Rauf
21BTE3CSE10002
Ex. No.:3 Basic plots using Matplotlib

Aim:

To draw basic plots in Python program using Matplotlib

ALGORITHM

Step1: Start
Step2: import Matplotlib module
Step3: Create a Basic plots using Matplotlib
Step4: Print the output
Step5: Stop

Program:3 a

Abdul Rauf
21BTE3CSE10002
Output:

Result:
Thus the count the frequency of occurrence of a word in a body of text is often needed
during text processing and Conditional Frequency Distribution program using python was
successfully
completed.

Abdul Rauf
21BTE3CSE10002
Ex. No.:4 Frequency distributions

Aim:

To Count the frequency of occurrence of a word in a body of text is often needed during
text processing.

ALGORITHM

Step 1: Start the Program


Step 2: Create text file blake-poems.txt
Step 3: Import the word_tokenize function and gutenberg
Step 4: Write the code to count the frequency of occurrence of a word in a body of text
Step 5: Print the result
Step 6: Stop the process

Program:

Abdul Rauf
21BTE3CSE10002
Output:

Result:

Thus the basic plots using Matplotlib in Python program was successfully completed.

Abdul Rauf
21BTE3CSE10002
Ex. No.:5 Averages
Aim:
To compute weighted averages in Python either defining your own functions or using Numpy

ALGORITHM

Step 1: Start the Program


Step 2: Create the employees_salary table and save as .csv file
Step 3: Import packages (pandas and numpy) and the employees_salary table
itself: Step 4: Calculate weighted sum and average using Numpy Average()
Function
Step 5 : Stop the process

Program:

Result:
Thus the compute weighted averages in Python either defining your own functions or using
Numpy was successfully completed.

Abdul Rauf
21BTE3CSE10002
Ex. No.: 6. Variability
Aim:
To write a python program to calculate the variance.

ALGORITHM

Step 1: Start the Program


Step 2: Import statistics module from statistics import variance
Step 3: Import fractions as parameter values from fractions import Fraction as fr
Step 4: Create tuple of a set of positive and negative numbers
Step 5: Print the variance of each samples
Step 6: Stop the process

Program:

Result:
Thus the computation for variance was successfully completed.

Abdul Rauf
21BTE3CSE10002
Ex. No.:7 Normal Curve
Aim:
To create a normal curve using python program.

ALGORITHM

Step 1: Start the Program


Step 2: Import packages scipy and call function
scipy.stats Step 3: Import packages numpy, matplotlib
and seaborn Step 4: Create the distribution
Step 5: Visualizing the distribution
Step 6: Stop the process

Program:

Output:

Abdul Rauf
21BTE3CSE10002
Result:

Thus the normal curve using python program was successfully completed.

Abdul Rauf
21BTE3CSE10002
Ex. No.: 8 Correlation and scatter plots

Aim:
To write a python program for correlation with scatter plot

ALGORITHM

Step 1: Start the Program


Step 2: Create variable y1, y2
Step 3: Create variable x, y3 using random function
Step 4: plot the scatter
plot Step 5: Print the
result Step 6: Stop the
process

Program:

Abdul Rauf
21BTE3CSE10002
Output

Result:

Thus the Correlation and scatter plots using python program was successfully completed.

Abdul Rauf
21BTE3CSE10002
Ex. No.: 9 Correlation coefficient
Aim:
To write a python program to compute correlation coefficient.

ALGORITHM

Step 1: Start the Program


Step 2: Import math package
Step 3: Define correlation coefficient function
Step 4: Calculate correlation using formula
Step 5:Print the result
Step 6 : Stop the process

Program:

Result:
Thus the computation for correlation coefficient was successfully completed.

Abdul Rauf
21BTE3CSE10002
Ex. No.: 10 Simple Linear Regression
Aim:
To write a python program for Simple Linear Regression

ALGORITHM

Step 1: Start the Program


Step 2: Import numpy and matplotlib package
Step 3: Define coefficient function
Step 4: Calculate cross-deviation and deviation about x
Step 5: Calculate regression coefficients
Step 6: Plot the Linear regression and define main function
Step 7: Print the result
Step 8: Stop the process

Program:

Abdul Rauf
21BTE3CSE10002
Output:

Result:
Thus the computation for Simple Linear Regression was successfully completed.

Abdul Rauf
21BTE3CSE10002

You might also like