SlideShare a Scribd company logo
2
Most read
5
Most read
8
Most read
Introduction to
numpy
Term paper-
Programming II
Submitted to:
Dr. Dharmendra Singh
Submitted by :
Gaurav
19mslsbf03
Table of Contents
 Introduction
 Operations using NumPy
 NumPy – A Replacement for MatLab
Installation of numpy package on Linux-Ubuntu
Numpy-ndarray
Numpy-matplotlib
Introduction
• NumPy is a Python package. It stands for 'Numerical
Python'. It is a library consisting of multidimensional array
objects and a collection of routines for processing of array.
• Numeric, the ancestor of NumPy, was developed by Jim
Hugunin. Another package Numarray was also developed,
having some additional functionalities. In 2005, Travis
Oliphant created NumPy package by incorporating the
features of Numarray into Numeric package. There are
many contributors to this open source project.
Operations using NumPy
Using NumPy, a developer can perform the following operations −
Mathematical and logical operations on arrays.
Fourier transforms and routines for shape manipulation.
Operations related to linear algebra. NumPy has in-built functions for
linear algebra and random number generation.
NumPy – A Replacement for MatLab
NumPy is often used along with packages like SciPy (Scientific
Python) and Mat−plotlib (plotting library). This combination is
widely used as a replacement for MatLab, a popular platform for
technical computing. However, Python alternative to MatLab is now
seen as a more modern and complete programming language.
It is open source, which is an added advantage of NumPy.
Installation of numpy package on Linux-Ubuntu
⁓$sudo apt-get install python-numpy
python-scipy python-
matplotlibipythonipythonnotebook
python-pandas python-sympy python-
nose
Use this command in the Terminal of Ubuntu system
to install numpy package
Numpy-ndarray
• The most important object defined in NumPy is an N-dimensional
array type called ndarray. It describes the collection of items of
the same type. Items in the collection can be accessed using a
zero-based index.
• Every item in an ndarray takes the same size of block in the
memory. Each element in ndarray is an object of data-type object
(called dtype).
Example
import numpy as np
a = np.array([1,2,3])
print a
import numpy as np
a = np.array([[1, 2], [3, 4]])
print a
import numpy as np
a = np.array([1, 2, 3,4,5], ndmin = 2)
print a
import numpy as np
a = np.array([1, 2, 3], dtype = complex)
print a
Numpy-Matplotlib
import numpy as np
from matplotlib import pyplot as plt
x = np.arange(1,11)
y = 2 * x + 5
plt.title("Matplotlib demo")
plt.xlabel("x axis caption")
plt.ylabel("y axis caption")
plt.plot(x,y)
plt.show()
import numpy as np
from matplotlib import pyplot as plt
x = np.arange(1,11)
y = 2 * x + 5
plt.title("Matplotlib demo")
plt.xlabel("x axis caption")
plt.ylabel("y axis caption")
plt.plot(x,y,"ob")
plt.show()
import numpy as np
import matplotlib.pyplot as plt
# Compute the x and y coordinates
for points on a sine curve
x = np.arange(0, 3 * np.pi, 0.1)
y = np.sin(x)
plt.title("sine wave form")
# Plot the points using matplotlib
plt.plot(x, y)
plt.show()
Sine Wave Plot
bar()
from matplotlib import pyplot as plt
x = [5,8,10]
y = [12,16,6]
x2 = [6,9,11]
y2 = [6,15,7]
plt.bar(x, y, align = 'center')
plt.bar(x2, y2, color = 'g', align = 'center')
plt.title('Bar graph')
plt.ylabel('Y axis')
plt.xlabel('X axis')
plt.show()
References
https://www.tutorialspoint.com/numpy
https://www.tutorialspoint.com/numpy/numpy_matplotlib.htm
https://www.tutorialspoint.com/numpy/numpy_ndarray_object.
htm

More Related Content

PDF
Numpy tutorial
PDF
Python NumPy Tutorial | NumPy Array | Edureka
PPTX
PPTX
Python - Numpy/Pandas/Matplot Machine Learning Libraries
PPTX
Python pandas Library
PPTX
Introduction to matplotlib
PPTX
Visualization and Matplotlib using Python.pptx
PDF
Pandas
Numpy tutorial
Python NumPy Tutorial | NumPy Array | Edureka
Python - Numpy/Pandas/Matplot Machine Learning Libraries
Python pandas Library
Introduction to matplotlib
Visualization and Matplotlib using Python.pptx
Pandas

What's hot (20)

PPTX
Unit 3 stack
PPT
Python Pandas
PDF
Introduction to NumPy (PyData SV 2013)
PDF
Data Analytics with Pandas and Numpy - Python
PPTX
Data Analysis in Python-NumPy
PDF
Python Matplotlib Tutorial | Matplotlib Tutorial | Python Tutorial | Python T...
PPTX
Introduction to pandas
PPTX
Python Scipy Numpy
PDF
pandas - Python Data Analysis
PPTX
Data structures and algorithms
PPTX
Python Data Structures and Algorithms.pptx
PDF
Python functions
PDF
Arrays in python
PPT
Python Dictionaries and Sets
PPTX
Python Seaborn Data Visualization
PDF
Data Visualization in Python
PPTX
String Manipulation in Python
PPTX
Modules in Python Programming
PPTX
Python Functions
PPTX
Perceptron & Neural Networks
Unit 3 stack
Python Pandas
Introduction to NumPy (PyData SV 2013)
Data Analytics with Pandas and Numpy - Python
Data Analysis in Python-NumPy
Python Matplotlib Tutorial | Matplotlib Tutorial | Python Tutorial | Python T...
Introduction to pandas
Python Scipy Numpy
pandas - Python Data Analysis
Data structures and algorithms
Python Data Structures and Algorithms.pptx
Python functions
Arrays in python
Python Dictionaries and Sets
Python Seaborn Data Visualization
Data Visualization in Python
String Manipulation in Python
Modules in Python Programming
Python Functions
Perceptron & Neural Networks
Ad

Similar to Introduction to numpy (20)

PPTX
Introduction-to-NumPy-in-Python (1).pptx
PPTX
NumPy.pptx
PPTX
Presentation1.pptxvghvfhgvbn nbnmbnbjkbjkbjib
PPTX
Lecture 2 _Foundions foundions NumPyI.pptx
PPTX
UNIT-03_Numpy (1) python yeksodbbsisbsjsjsh
PPTX
NumPy.pptx Bachelor of Computer Application
PPTX
Introduction to numpy.pptx
PPTX
Chapter 4 NumPy Basics Arrays and Vectorized Computation (Part I).pptx
PPTX
Numpy and Pandas Introduction for Beginners
PPTX
NumPy.pptx
PPTX
Numpy Library introducton in Python.pptx
PPT
CAP776Numpy (2).ppt
PPT
CAP776Numpy.ppt
PPT
Introduction to Numpy Foundation Study GuideStudyGuide
PPTX
NumPy.pptx
PDF
Numpy,Python Library, Pandas, AI, Machine Learning
PPTX
PPTX
1.NumPy is a Python library used for wor
PDF
Introduction to NumPy
Introduction-to-NumPy-in-Python (1).pptx
NumPy.pptx
Presentation1.pptxvghvfhgvbn nbnmbnbjkbjkbjib
Lecture 2 _Foundions foundions NumPyI.pptx
UNIT-03_Numpy (1) python yeksodbbsisbsjsjsh
NumPy.pptx Bachelor of Computer Application
Introduction to numpy.pptx
Chapter 4 NumPy Basics Arrays and Vectorized Computation (Part I).pptx
Numpy and Pandas Introduction for Beginners
NumPy.pptx
Numpy Library introducton in Python.pptx
CAP776Numpy (2).ppt
CAP776Numpy.ppt
Introduction to Numpy Foundation Study GuideStudyGuide
NumPy.pptx
Numpy,Python Library, Pandas, AI, Machine Learning
1.NumPy is a Python library used for wor
Introduction to NumPy
Ad

More from Gaurav Aggarwal (12)

PPTX
Optimal gene circuit design
PPTX
Ethics in assisted reproductive technologies
PPTX
Descriptors
PPTX
Apriori algorithm
PPTX
Epidemiology, Genetic Recombination, and Pathogenesis of Coronaviruses
PPT
Sequence analysis
PPTX
Immunity to microbes
PPTX
Challenges and drawbacks of drug discovery and development
PPTX
PPTX
Forces stabilizing nucleic acid structure
PPTX
Memory management in python
PPTX
Enzyme catalysis
Optimal gene circuit design
Ethics in assisted reproductive technologies
Descriptors
Apriori algorithm
Epidemiology, Genetic Recombination, and Pathogenesis of Coronaviruses
Sequence analysis
Immunity to microbes
Challenges and drawbacks of drug discovery and development
Forces stabilizing nucleic acid structure
Memory management in python
Enzyme catalysis

Recently uploaded (20)

PPTX
Introduction to Firewall Analytics - Interfirewall and Transfirewall.pptx
PPTX
ALIMENTARY AND BILIARY CONDITIONS 3-1.pptx
PDF
Foundation of Data Science unit number two notes
PPTX
01_intro xxxxxxxxxxfffffffffffaaaaaaaaaaafg
PPTX
iec ppt-1 pptx icmr ppt on rehabilitation.pptx
PPTX
Introduction to Basics of Ethical Hacking and Penetration Testing -Unit No. 1...
PPTX
oil_refinery_comprehensive_20250804084928 (1).pptx
PPTX
Supervised vs unsupervised machine learning algorithms
PPT
ISS -ESG Data flows What is ESG and HowHow
PPTX
Qualitative Qantitative and Mixed Methods.pptx
PDF
“Getting Started with Data Analytics Using R – Concepts, Tools & Case Studies”
PPTX
STUDY DESIGN details- Lt Col Maksud (21).pptx
PPTX
Introduction-to-Cloud-ComputingFinal.pptx
PPTX
Acceptance and paychological effects of mandatory extra coach I classes.pptx
PPTX
The THESIS FINAL-DEFENSE-PRESENTATION.pptx
PDF
Clinical guidelines as a resource for EBP(1).pdf
PPTX
Introduction to Knowledge Engineering Part 1
PPTX
Microsoft-Fabric-Unifying-Analytics-for-the-Modern-Enterprise Solution.pptx
PPTX
1_Introduction to advance data techniques.pptx
Introduction to Firewall Analytics - Interfirewall and Transfirewall.pptx
ALIMENTARY AND BILIARY CONDITIONS 3-1.pptx
Foundation of Data Science unit number two notes
01_intro xxxxxxxxxxfffffffffffaaaaaaaaaaafg
iec ppt-1 pptx icmr ppt on rehabilitation.pptx
Introduction to Basics of Ethical Hacking and Penetration Testing -Unit No. 1...
oil_refinery_comprehensive_20250804084928 (1).pptx
Supervised vs unsupervised machine learning algorithms
ISS -ESG Data flows What is ESG and HowHow
Qualitative Qantitative and Mixed Methods.pptx
“Getting Started with Data Analytics Using R – Concepts, Tools & Case Studies”
STUDY DESIGN details- Lt Col Maksud (21).pptx
Introduction-to-Cloud-ComputingFinal.pptx
Acceptance and paychological effects of mandatory extra coach I classes.pptx
The THESIS FINAL-DEFENSE-PRESENTATION.pptx
Clinical guidelines as a resource for EBP(1).pdf
Introduction to Knowledge Engineering Part 1
Microsoft-Fabric-Unifying-Analytics-for-the-Modern-Enterprise Solution.pptx
1_Introduction to advance data techniques.pptx

Introduction to numpy

  • 2. Term paper- Programming II Submitted to: Dr. Dharmendra Singh Submitted by : Gaurav 19mslsbf03
  • 3. Table of Contents  Introduction  Operations using NumPy  NumPy – A Replacement for MatLab Installation of numpy package on Linux-Ubuntu Numpy-ndarray Numpy-matplotlib
  • 4. Introduction • NumPy is a Python package. It stands for 'Numerical Python'. It is a library consisting of multidimensional array objects and a collection of routines for processing of array. • Numeric, the ancestor of NumPy, was developed by Jim Hugunin. Another package Numarray was also developed, having some additional functionalities. In 2005, Travis Oliphant created NumPy package by incorporating the features of Numarray into Numeric package. There are many contributors to this open source project.
  • 5. Operations using NumPy Using NumPy, a developer can perform the following operations − Mathematical and logical operations on arrays. Fourier transforms and routines for shape manipulation. Operations related to linear algebra. NumPy has in-built functions for linear algebra and random number generation. NumPy – A Replacement for MatLab NumPy is often used along with packages like SciPy (Scientific Python) and Mat−plotlib (plotting library). This combination is widely used as a replacement for MatLab, a popular platform for technical computing. However, Python alternative to MatLab is now seen as a more modern and complete programming language. It is open source, which is an added advantage of NumPy.
  • 6. Installation of numpy package on Linux-Ubuntu ⁓$sudo apt-get install python-numpy python-scipy python- matplotlibipythonipythonnotebook python-pandas python-sympy python- nose Use this command in the Terminal of Ubuntu system to install numpy package
  • 7. Numpy-ndarray • The most important object defined in NumPy is an N-dimensional array type called ndarray. It describes the collection of items of the same type. Items in the collection can be accessed using a zero-based index. • Every item in an ndarray takes the same size of block in the memory. Each element in ndarray is an object of data-type object (called dtype).
  • 8. Example import numpy as np a = np.array([1,2,3]) print a import numpy as np a = np.array([[1, 2], [3, 4]]) print a import numpy as np a = np.array([1, 2, 3,4,5], ndmin = 2) print a import numpy as np a = np.array([1, 2, 3], dtype = complex) print a
  • 9. Numpy-Matplotlib import numpy as np from matplotlib import pyplot as plt x = np.arange(1,11) y = 2 * x + 5 plt.title("Matplotlib demo") plt.xlabel("x axis caption") plt.ylabel("y axis caption") plt.plot(x,y) plt.show()
  • 10. import numpy as np from matplotlib import pyplot as plt x = np.arange(1,11) y = 2 * x + 5 plt.title("Matplotlib demo") plt.xlabel("x axis caption") plt.ylabel("y axis caption") plt.plot(x,y,"ob") plt.show()
  • 11. import numpy as np import matplotlib.pyplot as plt # Compute the x and y coordinates for points on a sine curve x = np.arange(0, 3 * np.pi, 0.1) y = np.sin(x) plt.title("sine wave form") # Plot the points using matplotlib plt.plot(x, y) plt.show() Sine Wave Plot
  • 12. bar() from matplotlib import pyplot as plt x = [5,8,10] y = [12,16,6] x2 = [6,9,11] y2 = [6,15,7] plt.bar(x, y, align = 'center') plt.bar(x2, y2, color = 'g', align = 'center') plt.title('Bar graph') plt.ylabel('Y axis') plt.xlabel('X axis') plt.show()