统计list中满足条件的数的个数

要求:统计list weights['value']中满足条件的数的个数:

>=0、<0的个数分别是多少

解决方法:

np.sum(list(map(lambda x: x >= 0, weights['value'])))

猜你喜欢

转载自blog.csdn.net/weixin_41770169/article/details/81084969
今日推荐