【发布时间】:2018-08-06 10:15:21
【问题描述】:
当我根据scipy.stats.binned_statistic (see here for example) 对我的数据进行分箱时,如何获得平均分箱值的误差(即标准偏差)?
例如,如果我将我的数据分类如下:
windspeed = 8 * np.random.rand(500)
boatspeed = .3 * windspeed**.5 + .2 * np.random.rand(500)
bin_means, bin_edges, binnumber = stats.binned_statistic(windspeed,
boatspeed, statistic='median', bins=[1,2,3,4,5,6,7])
plt.figure()
plt.plot(windspeed, boatspeed, 'b.', label='raw data')
plt.hlines(bin_means, bin_edges[:-1], bin_edges[1:], colors='g', lw=5,
label='binned statistic of data')
plt.legend()
如何获得bin_means 的标准差?
【问题讨论】:
-
bin_means上的错误定义是什么?您可能应该在问题陈述中说明它是什么。
-
@RobertDodier,标准差就可以了。
标签: python statistics binning