开始使用免费开始使用

dtype 参数

控制 NumPy 数组数据类型的一种方式,是在创建数组时通过 dtype 关键字参数进行声明。先看看使用 np.zeros() 创建数组时,NumPy 默认采用的数据类型。能否把它改成别的类型?

numpy 已作为 np 导入。

本练习是课程的一部分

NumPy 入门

查看课程

交互式实操练习

通过完成这段示例代码来试试这个练习。

# Create an array of zeros with three rows and two columns
zero_array = ____

# Print the data type of zero_array
print(____)
编辑并运行代码