截断浮点数的十进制数字numpy数组 [英] Truncating decimal digits numpy array of floats

查看:88
本文介绍了截断浮点数的十进制数字numpy数组的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想截断numpy数组中的float值,例如.

I want to truncate the float values within the numpy array, for .e.g.

2.34341232 --> 2.34 

我阅读了截断浮点的文章,但其中只有一个浮点.我不想在numpy数组上运行循环,这将非常昂贵. numpy中是否有任何内置方法可以轻松做到这一点?我确实需要将输出作为浮点数而不是字符串.

I read the post truncate floating point but its for one float. I don't want to run a loop on the numpy array, it will be quite expensive. Is there any inbuilt method within numpy which can do this easily? I do need output as a float not string.

推荐答案

使用 查看全文

登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆