使用numpy中的astype()方法可以实现,示例如下:
x
Out[20]:
array([[ 5. , 4. ],
[ 4. , 4.33333333],
[ 3.66666667, 4.5 ]])
x.astype(int)
Out[21]:
array([[5, 4],
[4, 4],
[3, 4]])
使用numpy中的astype()方法可以实现,示例如下:
x
Out[20]:
array([[ 5. , 4. ],
[ 4. , 4.33333333],
[ 3.66666667, 4.5 ]])
x.astype(int)
Out[21]:
array([[5, 4],
[4, 4],
[3, 4]])
本文详细的介绍了,在Java 中数组的使用,并对其内存存在形式进行了详细的分析。
最近在笔试的时候,发现自己有些基础有些遗忘了,虽然当时的做法也是这么做的,但是一直以为会有更简单的方法,如果有
举报文章
请选择举报类型
补充说明
0/200
上传截图
格式支持JPEG/PNG/JPG,图片不超过1.9M