Week 13 Numpy
Week 13 Numpy
NumPy
• We have learnt about various data types like list, tuple, and dictionary
• Now we discuss another datatype ”Array”
• An array is a data type used to store multiple values using a single
identifier (variable name)
• An array contains an ordered collection of data elements where each
element is of the same type and can be referenced by its index
(position)
• Each element of the array is same data type, though the values
stored in them may be different
• The entire array is stored contiguously in memory. This makes
operations on array fast
• Each element of the array is identified or referred using the name of
the array along with the index of that element, which is unique for
each element. The index of an element is an integral value associated
with the element, based on the element’s position in the array. For
example consider an array with 5 numbers: [ 10, 9, 99, 71, 90 ]
• NumPy arrays are used to store lists of numerical data, vectors and
matrices
• The NumPy library has a large set of routines (built-in functions) for
creating, manipulating, and transforming NumPy arrays
• NumPy array is officially called ndarray but commonly known as array.
Observe that since there is a string value in the list, all integer and float
values have been promoted to string, while converting the list to array.
We can create an array with numbers in a given range and sequence using
the arange() function. This function is similar to the range() function of
Python
• Slicing