如何从 X 和 Y 数组创建 NumPy XY 数组(zip 等价物)
如果你在 Python 中有两个长度相同的 1D 数组 x 和 y(n = x.shape[0]),这就是你可以使用 numpy 创建形状为 (n, 2) 的数组的方式,类似于 Python 的 zip 对 list 对象的做法:
numpy_xy_stack.py
xy = np.stack((x, y), axis=1)Check out similar posts by category:
Python
If this post helped you, please consider buying me a coffee or donating via PayPal to support research & publishing of new posts on TechOverflow