将一个10×2的笛卡尔坐标矩阵转换为极坐标 (★★☆)
(提示: np.sqrt, np.arctan2)
Z = np.random.random((10, 2))
X, Y = Z[:, 0], Z...创建一个结构化数组,其中x和y坐标覆盖[0, 1]x[1, 0]区域 (★★☆)
(提示: np.meshgrid)
Z = np.zeros((5, 5), [('x', float), ('y',...创建表示位置(x, y)和颜色(r, g, b, a)的结构化数组 (★★☆)
(提示: dtype)
Z = np.zeros(10, [('position', [('x', float, 1),...Y = np.atleast_2d(Z[:, 0], Z[:, 1])
D = np.sqrt((X-X.T)**2 + (Y-Y.T)**2)
print (D)
# 使用scipy库可以更快
import..., 因为Python2 和Python3 在这个地方有兼容性问题
Z = np.genfromtxt("example.txt", delimiter=",")
print(Z)
55. numpy