NumPy#
[NumPy] 是 Python 中科学计算的基础包。它是一个 Python 库,提供了多维数组对象、各种派生对象(如掩码数组和矩阵),以及一系列用于快速操作数组的例程,包括数学运算、逻辑运算、形状操作、排序、选择、输入输出、离散傅里叶变换、基本线性代数、基本统计操作、随机模拟等。
- 什么是 NumPy?
- NumPy:初学者的绝对基础
- 数组创建
- 对
ndarrays的索引 - Importing data with
genfromtxt() - 广播
- 拷贝与视图
- Working with Arrays of Strings And Bytes
- Structured arrays
- Introduction
- Structured datatypes
- Indexing and assignment to structured arrays
- Record arrays
- Recarray helper functions
append_fields()apply_along_fields()assign_fields_by_name()drop_fields()find_duplicates()flatten_descr()get_fieldstructure()get_names()get_names_flat()join_by()merge_arrays()rec_append_fields()rec_drop_fields()rec_join()recursive_fill_fields()rename_fields()repack_fields()require_fields()stack_arrays()structured_to_unstructured()unstructured_to_structured()
- Recarray helper functions
- Writing custom array containers
- 与 NumPy 的互操作性
- Subclassing ndarray
- Introduction
- View casting
- Creating new from template
- Relationship of view casting and new-from-template
- Implications for subclassing
- Simple example - adding an extra attribute to ndarray
- Slightly more realistic example - attribute added to existing array
__array_ufunc__for ufuncs__array_wrap__for ufuncs and other functions- Extra gotchas - custom
__del__methods and ndarray.base - Subclassing and downstream compatibility
- NumPy 教程
- Determining Moore’s Law with real data in NumPy
- Saving and sharing your NumPy arrays
- What you’ll learn
- What you’ll do
- What you’ll need
- Create your arrays
- Save your arrays with NumPy’s
savez - Remove the saved arrays and load them back with NumPy’s
load - Reassign the NpzFile arrays to
xandy - Success
- Another option: saving to human-readable csv
- Rearrange the data into a single 2D array
- Save the data to csv file using
savetxt - Our arrays as a csv file
- Success, but remember your types
- Wrapping up
- Analyzing the impact of the lockdown on air quality in Delhi, India
- Deep learning on MNIST
- Deep reinforcement learning with Pong from pixels
- Masked Arrays
- Plotting Fractals
- Determining Static Equilibrium in NumPy
- Linear algebra on n-dimensional arrays
- X-ray image processing