0% found this document useful (0 votes)
32 views4 pages

NumPy Array and Matrix Operations Guide

The document contains practical exercises demonstrating basic NumPy operations, including converting a list to a one-dimensional array, creating a 3x3 matrix, appending values to an array, and reshaping an array without altering its data. Each practical includes code snippets and expected outputs. The exercises aim to familiarize users with fundamental NumPy functionalities.

Uploaded by

shreyptl2981
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)
32 views4 pages

NumPy Array and Matrix Operations Guide

The document contains practical exercises demonstrating basic NumPy operations, including converting a list to a one-dimensional array, creating a 3x3 matrix, appending values to an array, and reshaping an array without altering its data. Each practical includes code snippets and expected outputs. The exercises aim to familiarize users with fundamental NumPy functionalities.

Uploaded by

shreyptl2981
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

Practical 2.

1
Aim :- To convert a list of numeric values into a one-dimensional
NumPy array

import numpy as np
l=[10,20,30,40,50,60]
print("List : ",l)
a=[Link](l)
print("Array : ",a)

Output :
Practical 2.2
Aim :- To create a 3x3 matrix with values ranging from 2 to 10.

import numpy as np
x=[Link](2,11).reshape(3,3)
x

Output :
Practical 2.3
Aim :- To append values at the end of an array

import numpy as np
a=[1,2,3]
b=[4,5,6]
c=[Link](a,b)
c

Output :
Practical 2.4
Aim :- To create another shape from an array without changing its
data(3*2 to 2*3)

import numpy as np
a=[1,2,3,4,5,6]
b=[Link](a,(3,2))
print("Reshape 3*2 : ")
print(b)
c=[Link](a,(2,3))
print("Reshape 2*3 : ")
print(c)

Output :

You might also like