#借用线性代数的说法, 一维数组通常称为矢量 (vector),二维数组通常称为矩阵(matrix)。
matrix = np.array([1,'Tim'],[2,'Joey'],[3,'Johnny'])
print(matrix)
TypeErrorTraceback (most recent call last)CellIn[10], line 1----> 1matrix=np.array([1,'Tim'],[2,'Joey'],[3,'Johnny']) 2print(matrix)TypeError: array() takes from 1 to 2 positional arguments but 3 were given
解决方法:
matrix = np.array([[1,'Tim'],[2,'Joey'],[3,'Johnny']])
print(matrix)