您的位置:首页 > 编程语言 > Python开发

Python - numpy元素类型

2017-07-12 15:43 260 查看
更改numpy中元素类型。

1. 在创建时,使用np.类型直接更改

data = np.ones((3,4), np.int)
2. astype

data = np.random.randn(3,4)
new_data = data.astype(int)
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  numpy Python