📜  python 如何创建一个数组 - Python 代码示例

📅  最后修改于: 2022-03-11 14:46:57.757000             🧑  作者: Mango

代码示例1
# Basic syntax:
np.ones((number_rows, number_cols), dtype=int)

# Example usage:
import numpy as np
np.ones((5, 3), dtype=int)
array([[1, 1, 1],
       [1, 1, 1],
       [1, 1, 1],
       [1, 1, 1],
       [1, 1, 1]])

# Note, use np.zeros to create an array of zeros