numpy,True/False转1/0,bool转int,float转bool,float转int1/0

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/guotong1988/article/details/86292470
import numpy as np
a = np.array([0.5,0.4,0.6])
print((a>0.5).astype(int))

猜你喜欢

转载自blog.csdn.net/guotong1988/article/details/86292470