【发布时间】:2018-08-30 10:14:49
【问题描述】:
是否有任何内置函数可以丢弃整数并在numpy 中仅保留浮点数。
import numpy as np
input = np.array([0.0, 0.01, 1.0, 2.0, 2.001, 2.002])
desired_ouput = some_function(input)
# Expected ouput
# desired_output = np.array([0.01, 2.001, 2.002])
【问题讨论】:
-
该数组中的所有值都是浮点数。 “float”并不意味着该值是非整数。