NumPy 1.26 中文官方指南(四)(2)https://developer.aliyun.com/article/1510621
- 1.18.0
- 亮点
- 新函数
- 在
numpy.random中添加多元超几何分布
- 废弃
np.fromfile和np.fromstring将在错误数据上报错- 在
ma.fill_value中废弃非标量数组作为填充值 - 废弃
PyArray_As1D,PyArray_As2D - 废弃了
np.alen - 废弃了金融函数
numpy.ma.mask_cols和numpy.ma.mask_row的axis参数已废弃
- 弃用的废止
- 兼容性说明
numpy.lib.recfunctions.drop_fields不再返回 None- 如果
numpy.argmin/argmax/min/max在数组中存在,则返回NaT - 现在
np.can_cast(np.uint64, np.timedelta64, casting='safe')为False - 从
numpy.random.Generator.integers中更改随机变量流 - 为
datetime64和timedelta64添加更多的 ufunc 循环 numpy.random中的模块已移动
- C API 更改
PyDataType_ISUNSIZED(descr)对于结构化数据类型现在返回 False
- 新特性
- 添加我们自己的
*.pxdcython 导入文件 - 现在可以输入一个轴的元组到
expand_dims中 - 支持 64 位 OpenBLAS
- 在 F2PY 中添加
--f2cmap选项
- 改进
- 相同大小的不同 C 数值类型具有唯一的名称
argwhere在 0 维数组上现在产生一致的结果- 为
random.permutation和random.shuffle添加axis参数 method关键字参数用于np.random.multivariate_normal- 为
numpy.fromstring增加复数支持 - 当
axis不为 None 时,numpy.unique有一致的轴顺序 numpy.matmul的布尔输出现在转换为布尔值numpy.random.randint在范围为2**32时产生不正确的值- 为
numpy.fromfile增加复数支持 gcc命名的编译器现在添加std=c99参数](发布/1.18.0-说明.html#std-c99-added-if-compiler-is-named-gcc)
- 变更
NaT现在排序到数组的末尾- 在
np.set_printoptions中不正确的threshold会引发TypeError或ValueError - 保存带有元数据的数据类型时发出警告
numpy.distutils在 LDFLAGS 和类似情况下的 append 行为发生更改- 移除未弃用的
numpy.random.entropy - 添加选项以安静地配置构建并用
-Werror构建
- 1.17.5
- 贡献者
- 已合并的拉取请求
- 1.17.4
- 亮点
- 贡献者
- 已合并的拉取请求
- 1.17.3
- 亮点
- 兼容性说明
- 贡献者
- 已合并的拉取请求
- 1.17.2
- 贡献者
- 已合并的拉取请求
- 1.17.1
- 贡献者
- 合并的拉取请求
- 1.17.0
- 亮点
- 新函数
- 废弃项
numpy.polynomial函数在传递float而非int时会警告- 弃用
numpy.distutils.exec_command和temp_file_name - C-API 封装数组的��写标志
numpy.nonzero不应该再在 0d 数组上调用- 写入
numpy.broadcast_arrays的结果会产生警告
- 未来的变化
- dtypes 中的形状为 1 的字段在将来的版本中不会被折叠成标量
- 兼容性说明
float16次正规化舍入- 使用 divmod 时的带符号零
MaskedArray.mask现在返回掩码的视图,而不是掩码本身- 不要在
numpy.frombuffer中查找__buffer__属性 out在take,choose,put中用于内存重叠时被缓冲- 加载时拆开解除引用需要显式选择
- 旧 random 模块中随机流的潜在变化
i0现在总是返回与输入相同形状的结果can_cast不再假设所有不安全的转换都是允许的ndarray.flags.writeable稍微更频繁地切换到 true
- C API 变化
- 维度或步长输入参数现在通过
npy_intp const*传递
- 新特性
- 具有可选择的随机数生成器的新可扩展
numpy.random模块 - libFLAME
- 用户定义的 BLAS 检测顺序
- 用户定义的 LAPACK 检测顺序
ufunc.reduce和相关函数现在接受一个where掩码- Timsort 和基数排序已替换 mergesort 以实现稳定排序
packbits和unpackbits接受一个order关键字unpackbits现在接受一个count参数linalg.svd和linalg.pinv在 Hermitian 输入上可能更快divmod操作现在支持两个timedelta64操作数fromfile现在接受一个offset参数pad的新模式 “empty”empty_like和相关函数现在接受一个shape参数- 浮点数标量实现
as_integer_ratio以匹配内置的 float - 结构化的
dtype对象可以用多个字段名称进行索引 .npy文件支持 Unicode 字段名称
- 改进
- 数组比较断言包括最大差异
- 用 pocketfft 库替换了基于 fftpack 的
fft模块 - 在
numpy.ctypeslib中对ctypes支持的进一步改进 numpy.errstate现在也是一个函数装饰器numpy.exp和numpy.log在 float32 实现上加速- 改进
numpy.pad的性能 numpy.interp更稳健地处理无穷大Pathlib支持fromfile,tofile和ndarray.dump- 对于 bool 和 int 类型的特定化的
isnan,isinf和isfiniteufuncs isfinite支持datetime64和timedelta64类型nan_to_num中添加了新的关键字- 分配过大的数组引起的 MemoryError 错误更加详细
floor,ceil和trunc现在尊重内置魔术方法quantile现在可以在Fraction和decimal.Decimal对象上使用matmul中支持对象数组
- 变更
median和percentile函数族不再对nan发出警告- 将
timedelta64 % 0行为调整为返回NaT - NumPy 函数现在始终支持通过
__array_function__进行重写 lib.recfunctions.structured_to_unstructured不会压缩单个字段视图clip现在在底层使用 ufunc__array_interface__偏移现在按照文档正常工作- 在
savez函数中将 pickle 协议设置为 3 以强制使用 zip64 标志 - 使用不存在的字段索引结构化数组时引发
KeyError而不是ValueError
- 1.16.6
- 亮点
- 新功能
- 允许
matmul (*@* operator)与对象数组一起使用。
- 兼容性说明
- 修复 bool 类型在 matmul(*@*操作符)中的回归
- 改进
- 数组比较断言包含最大差异
- 贡献者
- 已合并的拉取请求
- 1.16.5
- 贡献者
- 已合并的拉取请求
- 1.16.4
- 新的停用功能
- C-API 封装数组的可写标记
- 兼容性注意事项
- 随机流的潜在改动
- 变更
numpy.lib.recfunctions.structured_to_unstructured不会压缩单字段视图
- 贡献者
- 已合并的拉取请求
- 1.16.3
- 兼容性注意事项
- 加载时解 pickling 需要显式选择
- 改进
- random.mvnormal中的协方差转换为 double
- 变更
__array_interface__偏移现在按照文档工作
- 1.16.2
- 兼容性注意事项
- 使用 divmod 时的有符号零
- 贡献者
- 已合并的拉取请求
- 1.16.1
- 贡献者
- 增强
- 兼容性注意事项
- 新特性
timedelta64操作数现在支持 divmod 操作
- 改进
np.ctypeslib中ctypes支持的进一步改进- 数组比较断言包括最大差异(array comparison assertions include maximum differences)
- 更改(Changes)
- 调整了
timedelta64 % 0的行为以返回NaT(timedelta64 % 0 behavior adjusted to return NaT)
- 1.16.0
- 亮点
- 新函数(New functions)
- 新的弃用特性(New deprecations)
- 过期的弃用特性(Expired deprecations)
- 未来的更改(Future changes)
- 兼容性注意事项(Compatibility notes)
- Windows 上的 f2py 脚本(f2py script on Windows)
- NaT 比较(NaT comparisons)
complex64/128的对齐方式已更改(complex64/128 alignment has changed)nd_grid __len__已移除(nd_grid len removal)np.unravel_index现在接受shape关键字参数- 多字段视图返回视图而不是副本(multi-field views return a view instead of a copy)
- C API 更改(C API changes)
- 新特性(New Features)
histogram中添加了综合平方误差(ISE)估计器(integrated squared error (ISE) estimator added to histogram)- 给
np.loadtxt添加了max_rows关键字(max_rows keyword added for np.loadtxt) np.timedelta64操作数现在有模运算支持(modulus operator support added for np.timedelta64 operands)
- 改进(Improvements)
- numpy 数组的无副本 pickling(no-copy pickling of numpy arrays)
- 构建独立的 shell(build shell independence)
- *
np.polynomial.Polynomial*类会在 Jupyter 笔记本中以 LaTeX 渲染(np.polynomial.Polynomial classes render in LaTeX in Jupyter notebooks) randint和choice现在适用于空分布(randint and choice now work on empty distributions)linalg.lstsq,linalg.qr, 和linalg.svd现在适用于空数组(linalg.lstsq, linalg.qr, and linalg.svd now work with empty arrays)- 错误的
PEP3118格式字符串会抛出更好的错误消息以链式异常处理(Chain exceptions to give better error messages for invalid PEP3118 format strings) - Einsum 优化路径更新和效率提升(Einsum optimization path updates and efficiency improvements)
numpy.angle和numpy.expand_dims现在适用于ndarray子类NPY_NO_DEPRECATED_API编译器警告抑制np.diff添加了 kwargs prepend 和 append- ARM 支持更新
- 追加到构建标志
- 广义 ufunc 签名现在允许固定大小的维度
- 广义 ufunc 签名现在允许灵活的维度
np.clip和clip方法检查内存重叠np.polyfit中cov选项的新值unscaled- 标量数值类型详细的文档字符串
__module__属性现在指向公共模块- 大型分配标记为透明大页适用
- Alpine Linux(以及其他 musl C 库发行版)支持
- 加快
np.block大型数组的速度 - 加快只读数组的
np.take - 支持类似路径对象的更多功能
- 在缩减过程中 ufunc 身份的行为更好
- 从 ctypes 对象改进的转换
- 一个新的
ndpointer.contents成员 matmul现在是一个ufunclinspace,logspace和geomspace的起始和停止数组- CI 扩展了额外的服务
- 更改
- 比较 ufunc 现在会报错而不是返回 NotImplemented
positive现在会对非数值数组发出弃用警告NDArrayOperatorsMixin现在实现矩阵乘法np.polyfit中协方差矩阵的缩放方式不同maximum和minimum不再发出警告- Umath 和 multiarray C 扩展模块合并为一个单独模块
getfield的有效性检查已扩展- NumPy 函数现在支持使用
__array_function__进行覆盖 - 基于只读缓冲区的数组不能设置为
writeable
- 1.15.4
- 兼容性注意事项
- 贡献者
- 已合并的拉取请求
- 1.15.3
- 兼容性注意事项
- 贡献者
- 已合并的拉取请求
- 1.15.2
- 兼容性注意事项
- 贡献者
- 已合并的拉取请求
- 1.15.1
- 兼容性注意事项
- 贡献者
- 已合并的拉取请求
- 1.15.0
- 亮点
- 新函数
- 废弃功能
- 未来变更
- 兼容性注意事项
- 编译测试模块重命名并设为私有
np.savez返回的NpzFile现在是collections.abc.Mapping- 在某些条件下,必须在上下文管理器中使用
nditer - Numpy 已转而使用 pytest 而不是 nose 进行测试
- Numpy 不再使用
__array_interface__向ctypes施加修改 np.ma.notmasked_contiguous和np.ma.flatnotmasked_contiguous现在总是返回列表np.squeeze恢复了无法处理axis参数的对象的旧行为- 非结构化 void 数组的
.item方法现在返回一个字节对象 copy.copy和copy.deepcopy不再将masked转换为数组- 结构化数组的多字段索引仍将返回一个副本](release/1.15.0-notes.html#multifield-indexing-of-structured-arrays-will-still-return-a-copy)
- C API 变更
- 新函数
npy_get_floatstatus_barrier和npy_clear_floatstatus_barrier PyArray_GetDTypeTransferFunction更改
- 新特性
np.gcd和np.lcm函数现针对整数和对象类型- 支持 iOS 跨平台构建
np.intersect1d添加了return_indices关键字np.quantile和np.nanquantile- 构建系统
- 改进
np.einsum更新np.ufunc.reduce和相关函数现在接受初始值np.flip可以在多个轴上操作histogram和histogramdd函数已移至np.lib.histograms- 在给定显示的 bins 时,
histogram将接受 NaN 值 - 当给定显式的 bin 边界时,
histogram可以处理日期时间类型 (release/1.15.0-notes.html#histogram-works-on-datetime-types-when-explicit-bin-edges-are-given) histogram的“auto”估计器更好地处理有限方差 (release/1.15.0-notes.html#histogram-auto-estimator-handles-limited-variance-better)histogram和histogramdd返回的边界现在与数据的浮点类型匹配 (release/1.15.0-notes.html#the-edges-returned-by-histogram-and-histogramdd-now-match-the-data-float-type)histogramdd允许在一部分轴上给定显式范围 (release/1.15.0-notes.html#histogramdd-allows-explicit-ranges-to-be-given-in-a-subset-of-axes)histogramdd和histogram2d的 normed 参数已重命名 (release/1.15.0-notes.html#the-normed-arguments-of-histogramdd-and-histogram2d-have-been-renamed)np.r_与 0d 数组一起使用,np.ma.mr_与np.ma.masked一起使用 (release/1.15.0-notes.html#np-r-works-with-0d-arrays-and-np-ma-mr-works-with-np-ma-masked)np.ptp接受keepdims参数和扩展的轴元组 (release/1.15.0-notes.html#np-ptp-accepts-a-keepdims-argument-and-extended-axis-tuples)MaskedArray.astype现在与ndarray.astype相同- 在编译时启用 AVX2/AVX512 (release/1.15.0-notes.html#enable-avx2-avx512-at-compile-time)
- 当接收标量或 0d 输入时,
nan_to_num总是返回标量 (release/1.15.0-notes.html#nan-to-num-always-returns-scalars-when-receiving-scalar-or-0d-inputs) np.flatnonzero在 numpy 可转换类型上工作 (release/1.15.0-notes.html#np-flatnonzero-works-on-numpy-convertible-types)np.interp返回 numpy 标量,而不是内建标量- 允许在 Python 2 中将 dtype 字段名设置为 Unicode (release/1.15.0-notes.html#allow-dtype-field-names-to-be-unicode-in-python-2)
- 比较 ufuncs 接受
dtype=object,覆盖默认的bool(release/1.15.0-notes.html#comparison-ufuncs-accept-dtype-object-overriding-the-default-bool) sort函数接受kind='stable'(release/1.15.0-notes.html#sort-functions-accept-kind-stable)- 对于原地累积不会产生临时副本 (release/1.15.0-notes.html#do-not-make-temporary-copies-for-in-place-accumulation)
linalg.matrix_power现在可以处理矩阵堆栈- 多维数组的
random.permutation性能提高了 (release/1.15.0-notes.html#increased-performance-in-random-permutation-for-multidimensional-arrays) - 广义 ufuncs 现在接受
axes、axis和keepdims参数 (release/1.15.0-notes.html#generalized-ufuncs-now-accept-axes-axis-and-keepdims-arguments) - 在 ppc 系统上,float128 值现在可以正确打印 (release/1.15.0-notes.html#float128-values-now-print-correctly-on-ppc-systems)
- 新的
np.take_along_axis和np.put_along_axis函数
- 1.14.6
- 贡献者
- 已合并的拉取请求
- 1.14.5
- 贡献者
- 已合并的拉取请求
- 1.14.4
- 贡献者
- 已合并的拉取请求
- 1.14.3
- 贡献者
- 已合并的拉取请求
- 1.14.2
- 贡献者
- 已合并的拉取请求
- 1.14.1
- 贡献者
- 已合并的拉取请求
- 1.14.0
- 亮点
- 新函数
- 已弃用项
- 未来变更
- 兼容性说明
- 遮罩数组视图的遮罩也是一个视图而不是一个拷贝](release/1.14.0-notes.html#the-mask-of-a-masked-array-view-is-also-a-view-rather-than-a-copy)
np.ma.masked不再可写np.ma函数生成的fill_value已更改a.flat.__array__()在a不连续时返回不可写的数组np.tensordot现在在收缩为 0 长度的维度时返回零数组numpy.testing重新组织np.asfarray不再接受非数据类型的dtype参数- 1D
np.linalg.norm保留浮点输入类型,即使对于任意阶数 count_nonzero(arr, axis=())现在计数不包括任何轴,而不是所有轴__init__.py文件已添加到测试目录- 对于非结构化
void数组,现在调用.astype(bool)将在每个元素上调用bool。 MaskedArray.squeeze永远不会返回np.ma.masked。- 将
can_cast的第一个参数从from重命名为from_。 - 当传递错误类型时,
isnat会引发TypeError。 - 当传递错误类型时,
dtype.__getitem__会引发TypeError。 - 现在用户定义类型需要实现
__str__和__repr__。 - 数组打印有许多变化,可通过新的“legacy”打印模式禁用。
- C API 变更。
UPDATEIFCOPY数组的 PyPy 兼容替代方法。
- 新特性。
- 文本 IO 函数的编码参数。
- 外部
nose插件可被numpy.testing.Tester使用。 numpy.testing中新增了parametrize装饰器。numpy.polynomial.chebyshev中新增了chebinterpolate函数。- Python 3 中支持读取
lzma压缩文本文件。 np.setprintoptions和np.array2string中新增了sign选项。np.linalg.matrix_rank中新增了hermitian选项。np.array2string中新增了threshold和edgeitems选项。concatenate和stack新增了out参数。- Windows 上支持 PGI flang 编译器。
- 改进。
- 在
random.noncentral_f中,分子自由度只需为正数。 - 所有
np.einsum变体都释放了 GIL](release/1.14.0-notes.html#the-gil-is-released-for-all-np-einsum-variations) - np.einsum 函数在可能的情况下将使用 BLAS 并默认进行优化](release/1.14.0-notes.html#the-np-einsum-function-will-use-blas-when-possible-and-optimize-by-default)
f2py现在处理 0 维数组](release/1.14.0-notes.html#f2py-now-handles-arrays-of-dimension-0)numpy.distutils支持同时使用 MSVC 和 mingw64-gfortran](release/1.14.0-notes.html#numpy-distutils-supports-using-msvc-and-mingw64-gfortran-together)np.linalg.pinv现在可以作用于堆叠矩阵](release/1.14.0-notes.html#np-linalg-pinv-now-works-on-stacked-matrices)numpy.save将数据对齐到 64 字节而不是 16- 现在可以在不使用临时文件的情况下编写 NPZ 文件](release/1.14.0-notes.html#npz-files-now-can-be-written-without-using-temporary-files)
- 空结构化和字符串类型的更好支持](release/1.14.0-notes.html#better-support-for-empty-structured-and-string-types)
np.lib.financial中支持decimal.Decimal](release/1.14.0-notes.html#support-for-decimal-decimal-in-np-lib-financial)- 浮点数打印现在使用“dragon4”算法进行最短的十进制表示](release/1.14.0-notes.html#float-printing-now-uses-dragon4-algorithm-for-shortest-decimal-representation)
void数据类型元素现在以十六进制表示打印](release/1.14.0-notes.html#void-datatype-elements-are-now-printed-in-hex-notation)void数据类型的打印风格现在可以单独定制](release/1.14.0-notes.html#printing-style-for-void-datatypes-is-now-independently-customizable)np.loadtxt的内存使用量减少](release/1.14.0-notes.html#reduced-memory-usage-of-np-loadtxt)
- 更改](release/1.14.0-notes.html#changes)
- 结构化数组的多字段索引/赋值](release/1.14.0-notes.html#multiple-field-indexing-assignment-of-structured-arrays)
- 整数和 Void 标量现在不受
np.set_string_function影响](release/1.14.0-notes.html#integer-and-void-scalars-are-now-unaffected-by-np-set-string-function) - 0d 数组打印已更改,已弃用 array2string 的
style参数](release/1.14.0-notes.html#d-array-printing-changed-style-arg-of-array2string-deprecated) - 使用数组播种
RandomState需要一个 1-d 数组](release/1.14.0-notes.html#seeding-randomstate-using-an-array-requires-a-1-d-array) MaskedArray对象显示更有用的repr](release/1.14.0-notes.html#maskedarray-objects-show-a-more-useful-repr)np.polynomial类的repr更为明确
- 1.13.3](release/1.13.3-notes.html)
- 贡献者](release/1.13.3-notes.html#contributors)
- 合并的拉取请求](release/1.13.3-notes.html#pull-requests-merged)
- 1.13.2](release/1.13.2-notes.html)
- 贡献者
- 合并的 Pull 请求
- 1.13.1
- 合并的 Pull 请求
- 贡献者
- 1.13.0
- 亮点
- 新的函数
- 弃用
- 未来的更改
- 构建系统更改
- 兼容性说明
- 错误类型更改
- 元组对象数据类型
- DeprecationWarning 转为 error
- 将 FutureWarning 更改为已更改的行为
- 数据类型现在总是为 true
__getslice__和__setslice__在ndarray子类中不再需要- 使用
...(省略号)索引 MaskedArrays/Constants 现在返回 MaskedArray
- C API 更改
- 在空数组和 NpyIter 中使用 GUfuncs 轴移除
- 添加了
PyArray_MapIterArrayCopyIfOverlap到 NumPy C-API
- 新特性
- 添加了
__array_ufunc__ - 新的
positiveufunc - 新的
divmodufunc np.isnatufunc 用于测试 NaT 特殊日期和时间差值的值np.heavisideufunc 计算 Heaviside 函数- 用于创建 blocked 数组的
np.block函数 isin函数,改进in1d- 临时省略
unique的axes参数np.gradient现在支持不均匀间隔的数据- 支持在
apply_along_axis中返回任意维度的数组 dtype添加了.ndim属性来补充.shape(查看详情)- Python 3.6 对 tracemalloc 的支持(查看详情)
- NumPy 可以使用放松的步幅检查调试构建(查看详情)
- 改进(查看详情)
- 重叠输入的 ufunc 行为(查看详情)
- MinGW 上对于 64 位 f2py 扩展的部分支持(查看详情)
packbits和unpackbits的性能改进(查看详情)- PPC 长双浮点信息的修复(查看详情)
ndarray子类的更好的默认 repr(查看详情)- 更可靠的掩码数组比较(查看详情)
np.matrix中的布尔元素现在可以使用字符串语法创建(查看详情)- 更多
linalg操作现在接受空向量和矩阵(查看详情) - 捆绑版本的 LAPACK 现在是 3.2.2(查看详情)
np.hypot.reduce和np.logical_xor的reduce在更多情况下被允许(查看详情)- 对象数组的更好
repr(查看详情)
- 改变(查看详情)
- 对掩码数组进行的
argsort现在具有与sort相同的默认参数(查看详情) average现在保留子类(查看详情)array == None和array != None现在进行按元素比较(查看详情)- 对于对象数组,
np.equal, np.not_equal忽略对象身份(查看详情) - 布尔索引变化(查看详情)
np.random.multivariate_normal在坏协方差矩阵下的行为(查看详情)assert_array_less现在对比np.inf和-np.inf(查看详情)assert_array_和屏蔽数组assert_equal隐藏了较少的警告memmap对象中的offset属性值np.real和np.imag为标量输入返回标量- 多项式便利类不能传递给 ufuncs
- 对 ufunc 方法,ufunc 的输出参数也可以是元组
NumPy 1.26 中文官方指南(四)(4)https://developer.aliyun.com/article/1510624