0% found this document useful (0 votes)
22 views35 pages

Understanding NumPy Arrays in Python

The document provides an overview of NumPy, a core library for scientific computing in Python that offers high-performance multidimensional array objects and efficient array operations. It explains the importance of arrays for storing numeric data, their creation, and various attributes such as dimensions, shape, and data types. Additionally, it touches on array mathematics, combining and splitting arrays, and basic operations like adding, removing, sorting, and filtering elements.
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
22 views35 pages

Understanding NumPy Arrays in Python

The document provides an overview of NumPy, a core library for scientific computing in Python that offers high-performance multidimensional array objects and efficient array operations. It explains the importance of arrays for storing numeric data, their creation, and various attributes such as dimensions, shape, and data types. Additionally, it touches on array mathematics, combining and splitting arrays, and basic operations like adding, removing, sorting, and filtering elements.
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Numerical Python

[Numpy]

Dr. Jagdish Chakole


Array
1. an array is a data structure that can hold a collection of items, typically of
the same type, in a sequential manner.

2. Arrays provide efficient storage and quick access to elements.

3. They are commonly used to store lists of numeric values.

4. Python has a built-in module called “array” that provides array


functionality, and the third-party library “numpy” offers more advanced
and efficient array operations.
Import array

Import numpy as np
Numpy (Numerical Python)

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.
Numpy (Numerical Python)
1. Stands for Numerical Python

2. Is the fundamental package required for high performance computing and data analysis
NumPy is so important for numerical computations in Python is because it is designed for
efficiency on large arrays of data.
3. It provides
ndarray for creating multiple dimensional arrays

Internally stores data in a contiguous block of memory, independent of other built-in


Python objects, use much less memory than built-in Python sequences.

Standard math functions for fast operations on entire arrays of data without having to
write loops.

NumPy Arrays are important because they enable you to express batch operations on data
without writing any for loops. We call this vectorization.
Array Creation
Import numpy as np

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

Arr=[Link]([[1,2,3,4,5,],[2,3,4,5,6],[3,4,5,6,7]])
•[Link]: The number of dimensions (axes) of the array.

•[Link]: A tuple representing the dimensions of the array. For a 2D array, it


would be (rows, columns).

•[Link]: The total number of elements in the array.

•[Link]: The data type of the elements in the array.

•[Link]: The size in bytes of each element in the array.

•[Link]: The total number of bytes consumed by the elements of the array.
Python List Vs numpy
Slicing in numpy
Slicing in numpy
Inspecting an array

Shape
Len
Ndim
Size
Type
Dtype
Astype(int)
Array Mathematics
Array Mathematics.
Array Mathematics..
Array Mathematics...
Array Mathematics….
Combining and
Splitting arrays
Combining and
Splitting arrays.
Combining and
Splitting arrays..
Combining and
Splitting arrays...
Add and Remove
elements in Arrays
Add and Remove
elements in Arrays.
Add and Remove
elements in Arrays..
Add and Remove
elements in Arrays...
SORT
Search
Filter

You might also like