[go: up one dir, main page]

0% found this document useful (0 votes)
171 views10 pages

NUMPY-lab Assignment-5

This document is a lab assignment on NumPy operations submitted to Christ University. It demonstrates creating arrays using various NumPy functions like array(), arange(), zeroes, ones, full(), eye(), random(), and linspace. It also covers determining array attributes like size, shape, data type, and indexing, slicing, and reshaping arrays. Code examples are provided for each operation along with the corresponding output.
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)
171 views10 pages

NUMPY-lab Assignment-5

This document is a lab assignment on NumPy operations submitted to Christ University. It demonstrates creating arrays using various NumPy functions like array(), arange(), zeroes, ones, full(), eye(), random(), and linspace. It also covers determining array attributes like size, shape, data type, and indexing, slicing, and reshaping arrays. Code examples are provided for each operation along with the corresponding output.
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/ 10

NUMPY

LAB-ASSIGNMENT-5
M.Sc. (DATA ANALYST) Dissertation 
Submitted to christ university 

Masters of Science
By

A.LAHARI
Registration Number: 2139465

submitted to
SIVAKUMAR.R

Department of Computer Science

CHRIST UNIVERSITY
Banglore, Karnataka-560029
(DEEMED TO BE  UNIVERSITY)
August, 2021
LAB ASSIGNMENT-5
NUMPY
1. Demonstrate the following Numpy operations:
i. Array Creation
array(), arange(), zeroes, ones, full(), eye(), random(), linspace() 

CODING:
1. Creating an array()

Output:

2.Using array()

Output:
3.Using zeroes()

Output:

4.Using ones()

Output:

5.Using full()

Output:
6.Using eye()

Output:

7.Using random()

Output:

8.Using linspace()
Output:

❖ Attributes of arrays: Determining the size, shape, memory consumption,


and data types of arrays
❖ ndim,
shape,
size,
dtype,
itemsize and
data

A. Creating an array to determine the dimensions of the array


Coding:

Output:
2. Creating an array to determine the shape of the array
Coding:

Output:

3.Creating size of an array()


Output:

4.Creating the data type in array

Coding:

Output:

5.Creating an datasize in a array()


Coding:

Output:

❖ Indexing of arrays:
Getting and setting the value of individual array elements

Output:

❖ .Slicing of arrays:
Getting and setting smaller sub arrays within a larger array

Coding:

Output:

❖ Reshaping of arrays:
Changing the shape of a given array – reshape()
Coding:
Output:

Error case:

Output:
As we cannot arrange the matrix into (3,3) it will show us an error

You might also like