NumPy: Array Manipulation
嚜燒umPy: Array Manipulation
Hendrik Speleers
NumPy: Array Manipulation
♂
Overview
每
1D and 2D arrays
♂
Creation, indexing and slicing
♂
Memory structure
每
Shape manipulation
每
Basic mathematical operations
每
♂
Arithmetic and logic operations
♂
Reduction and linear algebra operations
Other operations
♂
Polynomial manipulation
♂
Input and output
Lab Calc
2023-2024
NumPy: Array Manipulation
♂
NumPy
每
Numerical Python
每
Python extension for multi-dimensional arrays
每
♂
Suited for creation and manipulation of numerical data
♂
Closer to hardware: more efficient
♂
Designed for scientific computation: more intuitive
Import convention
import numpy as np
Lab Calc
2023-2024
NumPy: Array Manipulation
♂
NumPy array
每
A NumPy array is a collection of objects of the same type
In [1]:
In [2]:
Out[2]:
In [3]:
Out[3]:
每
a = np.array([0, 1, 2, 3])
a
array([0, 1, 2, 3])
a.size
4
Default object types of an array
♂
boolean (bool), integer (int, int64)
♂
float (float, float64), complex (complex, complex128)
Lab Calc
2023-2024
NumPy: Array Manipulation
♂
NumPy array
每
More compact and more efficient operations than list
In [1]: L = 100000
In [2]: a = range(L)
In [3]: %timeit [i**2 for i in a]
16.4 ms ㊣ 8.6 ?s per loop (mean ㊣ std. dev. of 7
runs, 100 loops each)
In [4]: b = np.arange(L)
In [5]: %timeit b**2
33.7 ?s ㊣ 43.4 ns per loop (mean ㊣ std. dev. of 7
runs, 10000 loops each)
Lab Calc
2023-2024
................
................
In order to avoid copyright disputes, this page is only a partial summary.
To fulfill the demand for quickly locating and searching documents.
It is intelligent file search solution for home and business.
Related download
- python for loop append numpy array weebly
- practical numpy and matplotlib intro meetup
- euler s method with python university of washington
- numpy for matlab users department of electrical
- lab 16 newton s method and basins of attraction
- perceptron algorithm with python
- deap documentation
- parallel computing in python using mpi4py
- numpy for matlab users mathesaurus
- numpy array manipulation