(逐项乘) 数组-数组 运算
当我们在矩阵间进行加减乘除时,它的默认行为是 element-wise(逐项乘) 的:
A * A # element-wise multiplication=> array...numpy/matrixlib/defmatrix.py", line 341, in __mul__
return N.dot(self, asmatrix(other)) ValueError...# reminder, the tempeature dataset is stored in the data variable:shape(data)
=> (77431, 7)
平均值
# the...))
=> array([[1, 2, 5],
[3, 4, 6]])
浅拷贝与深拷贝
为了获得高性能,Python 中的赋值常常不拷贝底层对象,这被称作浅拷贝。...但是有些时候迭代又是不可避免的,这种情况下用 Python 的for 是最方便的:
v = array([1,2,3,4])for element in v: print(element)
=>