Questions tagged «mean»



2
Python Pandas:按分组分组,平均?
我有一个这样的数据框: cluster org time 1 a 8 1 a 6 2 h 34 1 c 23 2 d 74 3 w 6 我想计算每个集群每个组织的平均时间。 预期结果: cluster mean(time) 1 15 ((8+6)/2+23)/2 2 54 (74+34)/2 3 6 我不知道如何在熊猫中做到这一点,有人可以帮忙吗?
92 python  pandas  group-by  mean 


4
np.mean和tf.reduce_mean有什么区别?
在MNIST初学者教程中,有一条声明 accuracy = tf.reduce_mean(tf.cast(correct_prediction, "float")) tf.cast基本上改变了对象的张量类型,但是tf.reduce_mean和之间有什么区别np.mean? 这是有关的文档tf.reduce_mean: reduce_mean(input_tensor, reduction_indices=None, keep_dims=False, name=None) input_tensor:张量减少。应为数字类型。 reduction_indices:要缩小的尺寸。如果None(默认)减小所有尺寸。 # 'x' is [[1., 1. ]] # [2., 2.]] tf.reduce_mean(x) ==> 1.5 tf.reduce_mean(x, 0) ==> [1.5, 1.5] tf.reduce_mean(x, 1) ==> [1., 2.] 对于一维矢量,它看起来像np.mean == tf.reduce_mean,但我不了解tf.reduce_mean(x, 1) ==> [1., 2.]。tf.reduce_mean(x, 0) ==> [1.5, 1.5]的意思是合理的,因为的意思是[1, 2]和[1, 2]是[1.5, 1.5],但是这是怎么回事tf.reduce_mean(x, 1)?


By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.