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

Introduction to NumPy: Fast Array Processing

Uploaded by

ltmonu
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
8 views13 pages

Introduction to NumPy: Fast Array Processing

Uploaded by

ltmonu
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd

INTRODUCTION TO

NUMPY
NUMPY
• NumPy is a general-purpose array-processing
package.
• It provides a high-performance multidimensional
array object and tools for working with these
arrays.
• It also has functions for working in domain of linear
algebra, Fourier transform, and matrices.
• It is open-source.
• NumPy was created in 2005 by Travis Oliphant. It is
an open source software .
• NumPy stands for Numerical Python.
WHY USE NUMPY?

• In Python we have lists that serve the purpose of


arrays, but they are slow to process.
• NumPy aims to provide an array object that is up to
50x faster than traditional Python lists.
• The array object in NumPy is called ndarray, it
provides a lot of supporting functions that make
working with ndarray very easy.
• Arrays are very frequently used in data science, where
speed and resources are very important.
WHY IS NUMPY FASTER THAN
LISTS?
• NumPy arrays are stored at one continuous
place in memory unlike lists, so processes can
access and manipulate them very efficiently.
• This behavior is called locality of reference in
computer science.
• This is the main reason why NumPy is faster
than lists. Also it is optimized to work with
latest CPU architectures.
WHICH LANGUAGE IS NUMPY
WRITTEN IN?
• NumPy is a Python library and is written
partially in Python, but most of the parts
that require fast computation are written in
C or C++.
FEATURES OF NUMPY

• Features of NumPy
– NumPy has various features including these
important ones:
– A powerful N-dimensional array object
– Sophisticated (broadcasting) functions
– Tools for integrating C/C++ and Fortran code
– Useful linear algebra, Fourier transform, and
random number capabilities
INSTALL PYTHON NUMPY

• Numpy can be installed


for Mac and Linux users via the following pip
command:
pip install numpy
• Import NumPy
• Once NumPy is installed, import it in your
applications by adding the import keyword:
• import numpy
• Example
• import numpy

arr = [Link]([1, 2, 3, 4, 5])

print(arr)

• NumPy as np
• NumPy is usually imported under the np
alias.
• Create an alias with the as keyword while
importing:
• Now the NumPy package can be referred to
as np instead of numpy.
• import numpy as np
• arr = [Link]([1, 2, 3, 4, 5])
• print(arr)

You might also like