第一次使用np.r_ 与np.c_时,出现了一下错误

TypeError: ‘RClass‘ object is not callable, TypeError: ‘CClass‘ object is not callable_python


TypeError: ‘RClass‘ object is not callable, TypeError: ‘CClass‘ object is not callable_python_02

说明:之所以会出现上面的报错,原因是我们把np.r_和np.c_用错了

#错误用法
a = np.array([[1,2,3],[7,8,9]])
b = np.array([[4,5,6],[10,11,12]])

c = np.r_(a,b)
print(c)

c = np.c_(a,b)
print(c)
#正确用法
a = np.array([[1,2,3],[7,8,9]])
b = np.array([[4,5,6],[10,11,12]])

c = np.r_[a,b]
print(c)

c = np.c_[a,b]
print(c)

注意是中括号!不是圆括号!