2
Most read
4
Most read
20
Most read
INTRODUCTION TO
NUMPY
By:
Sharmila Chidaravalli
Assistant Professor
Department of Information Science & Engineering
Global Academy of Technology
What is NumPy?
The NumPy library is the core library for scientific computing in Python.
It provides a high performance multidimensional array object and tools for
working with these arrays.
The key to NumPy is the ndarray object, an n-dimensional array of homogeneous
data types, with many operations being performed in compiled code for
performance.
What is NumPy?
There are several important differences between NumPy arrays and the standard
Python sequences:
NumPy arrays have a fixed size. Modifying the size means creating a new array.
NumPy arrays must be of the same data type, but this can include Python objects.
More efficient mathematical operations than built-in sequence types.
import numpy as np
A=[[1,2,3],[4,5,6]]
print(A)
type(A)
Output:
[[1, 2, 3], [4, 5, 6]]
list
Output:
[[1, 2, 3], [4, 5, 6]]
list
A = np.array(A)
print(A)
type(A)
[[1 2 3] [4 5 6]]
numpy.ndarray
print(np . ndim(A)) Ans : ?
print(np . ndim(A)) Ans : 2
print(np. shape(A)) Ans : ?
print(np . ndim(A)) Ans : 2
print(np. shape(A)) Ans : (2,3)
rows = np.shape(A)[0]
columns = np.shape(A)[1]
print("number of rows = ",rows)
print("number of columns = ", columns)
Output:
number of rows = 2
number of columns = 3
import numpy as np
a = np.arange(15).reshape(3, 5)
print(a)
print(a.ndim)
print(a.shape)
print(a.dtype.name)
print(a.itemsize)
print(a.size)
b = np.array([6, 7, 8])
print(b)
type(b)
Ans:
[[ 0 1 2 3 4]
[ 5 6 7 8 9]
[10 11 12 13 14]]
2
(3, 5)
int64
8 15
[6 7 8]
numpy.ndarray
Array Creation
a = np.array([2,3,4])
print(a)
a.dtype
b = np.array([1.2, 3.5, 5.1])
print(b)
b.dtype
[2 3 4]
dtype('int64')
[1.2 3.5 5.1]
dtype('float64')
b = np.array([(1.5,2,3), (4,5,6)])
print(b)
[[1.5 2. 3. ]
[4. 5. 6. ]]
array transforms sequences of sequences into two-dimensional
arrays, sequences of sequences of sequences into three-
dimensional arrays, and so on.
c = np.array( [ [1,2], [3,4] ], dtype=complex )
print(c)
The type of the array can also be explicitly specified at creation time:
[[1.+0.j 2.+0.j]
3.+0.j 4.+0.j]]
c=np.array([1,2,3,4,5,6,7,8,9,10])
print(c)
D=np.reshape(c,(2,5))
print(D)
[ 1 2 3 4 5 6 7 8 9 10]
[[ 1 2 3 4 5]
[ 6 7 8 9 10]]
The elements of an array are originally unknown, but its size is known.
Hence, NumPy offers several functions to create arrays with initial placeholder content. These minimize
the necessity of growing arrays, an expensive operation.
The function zeros creates an array full of zeros, the function ones creates an array full of ones, and the
function empty creates an array whose initial content is random and depends on the state of the memory.
By default, the dtype of the created array is float64.
print(np.zeros( (3,4) ))
print(np.ones( (2,3,4), dtype=np.int16 ) )
print(np.empty( (2,3) ) )
[[0. 0. 0. 0.]
[0. 0. 0. 0.]
[0. 0. 0. 0.]]
[[[1 1 1 1]
[1 1 1 1]
[1 1 1 1]]
[[1 1 1 1]
[1 1 1 1]
[1 1 1 1]]]
[[1.39069238e-309 1.39069238e-309 1.39069238e-309]
[1.39069238e-309 1.39069238e-309 1.39069238e-309]]
To create sequences of numbers, NumPy provides a function analogous to range that returns arrays instead of lists.
np.arange( 10, 30, 5 )
np.arange( 0, 2, 0.3 )
[10, 15, 20, 25]
[ 0. , 0.3, 0.6, 0.9, 1.2, 1.5, 1.8]
When arange is used with floating point arguments, it is generally not possible to predict the number of elements
obtained, due to the finite floating point precision. For this reason, it is usually better to use the function linspace
that receives as an argument the number of elements that we want .
from numpy import pi
print(np.linspace( 0, 2, 9 ))
x = np.linspace( 0, 2*pi, 100 )
print(x)
f = np.sin(x)
print(f)
Ans: ?
Basic Operations
Arithmetic operators on arrays apply elementwise.
A new array is created and filled with the result.
a = np.array( [20,30,40,50] )
print(a)
b = np.arange( 4 )
print(b)
c = a-b
print(c)
print(b**2)
print(10*np.sin(a))
print(a<35)
Ans: ?
Unlike in many matrix languages,
the product operator * operates element wise in NumPy arrays.
The matrix product can be performed using the @ operator (in python >=3.5) or the
dot function or method
A= np.array( [[1,1],
[0,1]] )
print(A)
B = np.array( [[2,0],
[3,4]] )
print(B)
print("The Element wise product")
print(A * B)
print("The Matrix Product")
print(A @ B)
print("The Matrix Product using dot function")
print(A.dot(B))
Ans: ?
a=np. array([1,2,3])
b=np.array([(1.5,2,3),(4,5,6)],dtype=float)
c=np. array([[(1.5,2,3),(4,5,6)],[(3,2,1),(4,5,6)]], dtype=float)
print("The 1D",a)
print("The 2D",b)
print("The 3D",c)
d=np.arange(10,25,5)
print(d)
e=np. full((2,2),7)
print("The full array")
print(e)
f=np. eye(3)
print(“The 3 *3 identity matrix")
print(f)
print("the random array")
print(np.random.random((2,2)))
Ans: ?
print("The subtraction of a& b :”)
print(np.subtract(a,b))
Similarly try
np.add(b,a)
np.divide(a,b)
np.multiply(a,b)
np.exp(b)
np.sqrt(b)
np.sin(a)
np.cos(b)
np.log(a)
Also try comparison operations
a == b
a < 2
np.array_equal(a,b)
Aggregate Functions
print(b.sum())
print(np.sum(b))
Similarly try
a.sum()
a.min()
b.max(axis = 0)
b.cumsum(axis = 1)
a.mean()
b.median()
a.corrcoef()
np.std(b)
Ans: ?
Copying Arrays
h=a.view()
print(h)
C=np.copy(b)
print(C)
h=a.copy()
print(h)
Sorting Arrays
b=np.array([5,7,2,4,1,9,6,0])
print(b)
print(np.sort(b))
a.sort()
c.sort(axis=0)
a=np. array([1,2,3])
b=np.array([(1.5,2,3),(4,5,6)],dtype=float)
1 2 3
1.5 2 3
4 5 6
Subsetting
a[2] 1 2 3
b[1,2] 1.5 2 3
4 5 6
Slicing
a[ 0 : 2 ] 1 2 3
a[ : : -1 ] 3 2 1
b[ 0 : 2 ,1 ]
1.5 2 3
4 5 6
b[ : 1 ]
1.5 2 3
4 5 6
b[ : 2 ] 1.5 2 3
4 5 6
Ans: ?
Indexing
a[a<2] 1 2 3
b[[1,0,1,0],[0,1,2,0]] [ 4. 2. 6. 1.5 ]
b[[1, 0, 1, 0]] [:,[0,1,2,0]] [[ 4. 5. 6. 4. ]
[1.5 2. 3. 1.5]
[4. 5. 6. 4. ]
[1.5 2. 3. 1.5]]
Transposing Array
i = np.transpose(b)
print(i)
i.T
Changing Array Shape
b.ravel() Flatten the array
g.reshape(3,-2) Reshape, but don’t change data
[[-0.5 0. 0. ] [-3. -3. -3. ]]
[[-0.5 0. 0. ]
[-3. -3. -3. ]]
array([[-0.5, 0. ],
[ 0. , -3. ],
[-3. , -3. ]])
After reshape
A = [[1,2,3],[4,5,6]]
print(A)
type(A)
A = np.asarray(A)
print(A)
type(A)
print("Maximum element is ",np.max(A))
print(np.min(A))
print(np.mean(A))
print(np.median(A))
print(np.std(A))
B = np.transpose(A)
print(B)
C = np.reshape(A,(1,6))
print(C)
rows = np.shape(C)[0]
columns = np.shape(C)[1]
print("number of rows = ",rows)
print("number of columns = ", columns)
print(A[0])
print(A[:,0])
print(A[:,1])
print(A)
print(A[:,0])
print(A[:,1])
print(A[:,2])
print(np.sum(A[:,0]))
print(np.sum(A[0,:]))

More Related Content

PPTX
PDF
Introduction to NumPy (PyData SV 2013)
PPTX
Introduction to pandas
PPTX
Data Analysis in Python-NumPy
PPTX
PPTX
Python - Numpy/Pandas/Matplot Machine Learning Libraries
PPTX
Introduction to matplotlib
PPTX
Pandas
Introduction to NumPy (PyData SV 2013)
Introduction to pandas
Data Analysis in Python-NumPy
Python - Numpy/Pandas/Matplot Machine Learning Libraries
Introduction to matplotlib
Pandas

What's hot (20)

PDF
Python NumPy Tutorial | NumPy Array | Edureka
PPTX
Data Structures in Python
PDF
Python Collections Tutorial | Edureka
PPTX
Python Data-Types
PDF
Strings in python
PPTX
Data Analysis with Python Pandas
PPTX
Seaborn.pptx
PPTX
List in Python
PPTX
Python: Modules and Packages
PPTX
DataFrame in Python Pandas
PDF
Introduction to Machine Learning with SciKit-Learn
PDF
Arrays in python
PDF
Python libraries
PPT
programming with python ppt
PPTX
stack & queue
PDF
Python programming : Files
PPTX
Introduction to numpy Session 1
PDF
Python recursion
PPT
Python Pandas
PPTX
Priority queue in DSA
Python NumPy Tutorial | NumPy Array | Edureka
Data Structures in Python
Python Collections Tutorial | Edureka
Python Data-Types
Strings in python
Data Analysis with Python Pandas
Seaborn.pptx
List in Python
Python: Modules and Packages
DataFrame in Python Pandas
Introduction to Machine Learning with SciKit-Learn
Arrays in python
Python libraries
programming with python ppt
stack & queue
Python programming : Files
Introduction to numpy Session 1
Python recursion
Python Pandas
Priority queue in DSA
Ad

Similar to NUMPY (20)

PPTX
NumPy-python-27-9-24-we.pptxNumPy-python-27-9-24-we.pptx
PPTX
UNIT-03_Numpy (1) python yeksodbbsisbsjsjsh
PPT
Introduction to Numpy Foundation Study GuideStudyGuide
PPTX
NUMPY LIBRARY study materials PPT 2.pptx
PPTX
NumPy.pptx
PPTX
NumPy.pptx
PPTX
1.NumPy is a Python library used for wor
PPT
CAP776Numpy (2).ppt
PPT
CAP776Numpy.ppt
PPTX
NUMPY [Autosaved] .pptx
PPTX
numpy code and examples with attributes.pptx
PDF
CE344L-200365-Lab2.pdf
PDF
The num py_library_20200818
PPTX
THE NUMPY LIBRARY of python with slides.pptx
PPTX
lec08-numpy.pptx
PDF
Numpy.pdf
PPTX
Lecture 2 _Foundions foundions NumPyI.pptx
PDF
Essential numpy before you start your Machine Learning journey in python.pdf
PDF
‏‏Lecture 2.pdf
PDF
Introduction to NumPy
NumPy-python-27-9-24-we.pptxNumPy-python-27-9-24-we.pptx
UNIT-03_Numpy (1) python yeksodbbsisbsjsjsh
Introduction to Numpy Foundation Study GuideStudyGuide
NUMPY LIBRARY study materials PPT 2.pptx
NumPy.pptx
NumPy.pptx
1.NumPy is a Python library used for wor
CAP776Numpy (2).ppt
CAP776Numpy.ppt
NUMPY [Autosaved] .pptx
numpy code and examples with attributes.pptx
CE344L-200365-Lab2.pdf
The num py_library_20200818
THE NUMPY LIBRARY of python with slides.pptx
lec08-numpy.pptx
Numpy.pdf
Lecture 2 _Foundions foundions NumPyI.pptx
Essential numpy before you start your Machine Learning journey in python.pdf
‏‏Lecture 2.pdf
Introduction to NumPy
Ad

More from Sharmila Chidaravalli (18)

PDF
Artificial Neural Network-Types,Perceptron,Problems
PDF
Clustering Algorithms - Kmeans,Min ALgorithm
PDF
Bayesian Learning - Naive Bayes Algorithm
PDF
KNN,Weighted KNN,Nearest Centroid Classifier,Locally Weighted Regression
PDF
Regression Analysis-Machine Learning -Different Types
PDF
Decision Tree-ID3,C4.5,CART,Regression Tree
PDF
Concept Learning - Find S Algorithm,Candidate Elimination Algorithm
PDF
Big Data Tools MapReduce,Hive and Pig.pdf
PDF
NoSQL BIg Data Analytics Mongo DB and Cassandra .pdf
PDF
Big Data Intoduction & Hadoop ArchitectureModule1.pdf
PPTX
Dms introduction Sharmila Chidaravalli
PDF
Assembly code
PDF
Direct Memory Access & Interrrupts
PPT
8255 Introduction
PPTX
System Modeling & Simulation Introduction
PDF
Travelling Salesperson Problem-Branch & Bound
PDF
Bellman ford algorithm -Shortest Path
Artificial Neural Network-Types,Perceptron,Problems
Clustering Algorithms - Kmeans,Min ALgorithm
Bayesian Learning - Naive Bayes Algorithm
KNN,Weighted KNN,Nearest Centroid Classifier,Locally Weighted Regression
Regression Analysis-Machine Learning -Different Types
Decision Tree-ID3,C4.5,CART,Regression Tree
Concept Learning - Find S Algorithm,Candidate Elimination Algorithm
Big Data Tools MapReduce,Hive and Pig.pdf
NoSQL BIg Data Analytics Mongo DB and Cassandra .pdf
Big Data Intoduction & Hadoop ArchitectureModule1.pdf
Dms introduction Sharmila Chidaravalli
Assembly code
Direct Memory Access & Interrrupts
8255 Introduction
System Modeling & Simulation Introduction
Travelling Salesperson Problem-Branch & Bound
Bellman ford algorithm -Shortest Path

Recently uploaded (20)

PDF
Module 1 part 1.pdf engineering notes s7
PDF
B461227.pdf American Journal of Multidisciplinary Research and Review
PDF
Performance, energy consumption and costs: a comparative analysis of automati...
PDF
Artificial Intelligence_ Basics .Artificial Intelligence_ Basics .
PPTX
Unit IImachinemachinetoolopeartions.pptx
DOCX
An investigation of the use of recycled crumb rubber as a partial replacement...
PPTX
Real Estate Management PART 1.pptxFFFFFFFFFFFFF
PDF
Using Technology to Foster Innovative Teaching Practices (www.kiu.ac.ug)
PPTX
IOP Unit 1.pptx for btech 1st year students
PDF
IAE-V2500 Engine for Airbus Family 319/320
PDF
Introduction to Machine Learning -Basic concepts,Models and Description
PPTX
MODULE 02 - CLOUD COMPUTING-Virtual Machines and Virtualization of Clusters a...
PPT
Module_1_Lecture_1_Introduction_To_Automation_In_Production_Systems2023.ppt
PPTX
DATA STRCUTURE LABORATORY -BCSL305(PRG1)
PPTX
22ME926Introduction to Business Intelligence and Analytics, Advanced Integrat...
PPTX
Solar energy pdf of gitam songa hemant k
PDF
AIGA 012_04 Cleaning of equipment for oxygen service_reformat Jan 12.pdf
PPTX
SC Robotics Team Safety Training Presentation
PPTX
Design ,Art Across Digital Realities and eXtended Reality
PDF
IAE-V2500 Engine Airbus Family A319/320
Module 1 part 1.pdf engineering notes s7
B461227.pdf American Journal of Multidisciplinary Research and Review
Performance, energy consumption and costs: a comparative analysis of automati...
Artificial Intelligence_ Basics .Artificial Intelligence_ Basics .
Unit IImachinemachinetoolopeartions.pptx
An investigation of the use of recycled crumb rubber as a partial replacement...
Real Estate Management PART 1.pptxFFFFFFFFFFFFF
Using Technology to Foster Innovative Teaching Practices (www.kiu.ac.ug)
IOP Unit 1.pptx for btech 1st year students
IAE-V2500 Engine for Airbus Family 319/320
Introduction to Machine Learning -Basic concepts,Models and Description
MODULE 02 - CLOUD COMPUTING-Virtual Machines and Virtualization of Clusters a...
Module_1_Lecture_1_Introduction_To_Automation_In_Production_Systems2023.ppt
DATA STRCUTURE LABORATORY -BCSL305(PRG1)
22ME926Introduction to Business Intelligence and Analytics, Advanced Integrat...
Solar energy pdf of gitam songa hemant k
AIGA 012_04 Cleaning of equipment for oxygen service_reformat Jan 12.pdf
SC Robotics Team Safety Training Presentation
Design ,Art Across Digital Realities and eXtended Reality
IAE-V2500 Engine Airbus Family A319/320

NUMPY

  • 1. INTRODUCTION TO NUMPY By: Sharmila Chidaravalli Assistant Professor Department of Information Science & Engineering Global Academy of Technology
  • 2. What is NumPy? The NumPy library is the core library for scientific computing in Python. It provides a high performance multidimensional array object and tools for working with these arrays. The key to NumPy is the ndarray object, an n-dimensional array of homogeneous data types, with many operations being performed in compiled code for performance.
  • 3. What is NumPy? There are several important differences between NumPy arrays and the standard Python sequences: NumPy arrays have a fixed size. Modifying the size means creating a new array. NumPy arrays must be of the same data type, but this can include Python objects. More efficient mathematical operations than built-in sequence types.
  • 4. import numpy as np A=[[1,2,3],[4,5,6]] print(A) type(A) Output: [[1, 2, 3], [4, 5, 6]] list Output: [[1, 2, 3], [4, 5, 6]] list A = np.array(A) print(A) type(A) [[1 2 3] [4 5 6]] numpy.ndarray
  • 6. print(np . ndim(A)) Ans : 2 print(np. shape(A)) Ans : ?
  • 7. print(np . ndim(A)) Ans : 2 print(np. shape(A)) Ans : (2,3) rows = np.shape(A)[0] columns = np.shape(A)[1] print("number of rows = ",rows) print("number of columns = ", columns) Output: number of rows = 2 number of columns = 3
  • 8. import numpy as np a = np.arange(15).reshape(3, 5) print(a) print(a.ndim) print(a.shape) print(a.dtype.name) print(a.itemsize) print(a.size) b = np.array([6, 7, 8]) print(b) type(b) Ans: [[ 0 1 2 3 4] [ 5 6 7 8 9] [10 11 12 13 14]] 2 (3, 5) int64 8 15 [6 7 8] numpy.ndarray
  • 9. Array Creation a = np.array([2,3,4]) print(a) a.dtype b = np.array([1.2, 3.5, 5.1]) print(b) b.dtype [2 3 4] dtype('int64') [1.2 3.5 5.1] dtype('float64') b = np.array([(1.5,2,3), (4,5,6)]) print(b) [[1.5 2. 3. ] [4. 5. 6. ]] array transforms sequences of sequences into two-dimensional arrays, sequences of sequences of sequences into three- dimensional arrays, and so on.
  • 10. c = np.array( [ [1,2], [3,4] ], dtype=complex ) print(c) The type of the array can also be explicitly specified at creation time: [[1.+0.j 2.+0.j] 3.+0.j 4.+0.j]] c=np.array([1,2,3,4,5,6,7,8,9,10]) print(c) D=np.reshape(c,(2,5)) print(D) [ 1 2 3 4 5 6 7 8 9 10] [[ 1 2 3 4 5] [ 6 7 8 9 10]]
  • 11. The elements of an array are originally unknown, but its size is known. Hence, NumPy offers several functions to create arrays with initial placeholder content. These minimize the necessity of growing arrays, an expensive operation. The function zeros creates an array full of zeros, the function ones creates an array full of ones, and the function empty creates an array whose initial content is random and depends on the state of the memory. By default, the dtype of the created array is float64. print(np.zeros( (3,4) )) print(np.ones( (2,3,4), dtype=np.int16 ) ) print(np.empty( (2,3) ) ) [[0. 0. 0. 0.] [0. 0. 0. 0.] [0. 0. 0. 0.]] [[[1 1 1 1] [1 1 1 1] [1 1 1 1]] [[1 1 1 1] [1 1 1 1] [1 1 1 1]]] [[1.39069238e-309 1.39069238e-309 1.39069238e-309] [1.39069238e-309 1.39069238e-309 1.39069238e-309]]
  • 12. To create sequences of numbers, NumPy provides a function analogous to range that returns arrays instead of lists. np.arange( 10, 30, 5 ) np.arange( 0, 2, 0.3 ) [10, 15, 20, 25] [ 0. , 0.3, 0.6, 0.9, 1.2, 1.5, 1.8] When arange is used with floating point arguments, it is generally not possible to predict the number of elements obtained, due to the finite floating point precision. For this reason, it is usually better to use the function linspace that receives as an argument the number of elements that we want . from numpy import pi print(np.linspace( 0, 2, 9 )) x = np.linspace( 0, 2*pi, 100 ) print(x) f = np.sin(x) print(f) Ans: ?
  • 13. Basic Operations Arithmetic operators on arrays apply elementwise. A new array is created and filled with the result. a = np.array( [20,30,40,50] ) print(a) b = np.arange( 4 ) print(b) c = a-b print(c) print(b**2) print(10*np.sin(a)) print(a<35) Ans: ?
  • 14. Unlike in many matrix languages, the product operator * operates element wise in NumPy arrays. The matrix product can be performed using the @ operator (in python >=3.5) or the dot function or method A= np.array( [[1,1], [0,1]] ) print(A) B = np.array( [[2,0], [3,4]] ) print(B) print("The Element wise product") print(A * B) print("The Matrix Product") print(A @ B) print("The Matrix Product using dot function") print(A.dot(B)) Ans: ?
  • 15. a=np. array([1,2,3]) b=np.array([(1.5,2,3),(4,5,6)],dtype=float) c=np. array([[(1.5,2,3),(4,5,6)],[(3,2,1),(4,5,6)]], dtype=float) print("The 1D",a) print("The 2D",b) print("The 3D",c) d=np.arange(10,25,5) print(d) e=np. full((2,2),7) print("The full array") print(e) f=np. eye(3) print(“The 3 *3 identity matrix") print(f) print("the random array") print(np.random.random((2,2))) Ans: ?
  • 16. print("The subtraction of a& b :”) print(np.subtract(a,b)) Similarly try np.add(b,a) np.divide(a,b) np.multiply(a,b) np.exp(b) np.sqrt(b) np.sin(a) np.cos(b) np.log(a) Also try comparison operations a == b a < 2 np.array_equal(a,b)
  • 17. Aggregate Functions print(b.sum()) print(np.sum(b)) Similarly try a.sum() a.min() b.max(axis = 0) b.cumsum(axis = 1) a.mean() b.median() a.corrcoef() np.std(b) Ans: ?
  • 19. a=np. array([1,2,3]) b=np.array([(1.5,2,3),(4,5,6)],dtype=float) 1 2 3 1.5 2 3 4 5 6 Subsetting a[2] 1 2 3 b[1,2] 1.5 2 3 4 5 6
  • 20. Slicing a[ 0 : 2 ] 1 2 3 a[ : : -1 ] 3 2 1 b[ 0 : 2 ,1 ] 1.5 2 3 4 5 6 b[ : 1 ] 1.5 2 3 4 5 6 b[ : 2 ] 1.5 2 3 4 5 6
  • 22. Indexing a[a<2] 1 2 3 b[[1,0,1,0],[0,1,2,0]] [ 4. 2. 6. 1.5 ] b[[1, 0, 1, 0]] [:,[0,1,2,0]] [[ 4. 5. 6. 4. ] [1.5 2. 3. 1.5] [4. 5. 6. 4. ] [1.5 2. 3. 1.5]]
  • 23. Transposing Array i = np.transpose(b) print(i) i.T Changing Array Shape b.ravel() Flatten the array g.reshape(3,-2) Reshape, but don’t change data [[-0.5 0. 0. ] [-3. -3. -3. ]] [[-0.5 0. 0. ] [-3. -3. -3. ]] array([[-0.5, 0. ], [ 0. , -3. ], [-3. , -3. ]]) After reshape
  • 24. A = [[1,2,3],[4,5,6]] print(A) type(A) A = np.asarray(A) print(A) type(A) print("Maximum element is ",np.max(A)) print(np.min(A)) print(np.mean(A)) print(np.median(A)) print(np.std(A)) B = np.transpose(A) print(B) C = np.reshape(A,(1,6)) print(C) rows = np.shape(C)[0] columns = np.shape(C)[1] print("number of rows = ",rows) print("number of columns = ", columns) print(A[0]) print(A[:,0]) print(A[:,1]) print(A) print(A[:,0]) print(A[:,1]) print(A[:,2]) print(np.sum(A[:,0])) print(np.sum(A[0,:]))