combine_pooled_moments¶
- passengersim.callbacks.combine.combine_pooled_moments(a: DataFrame, b: DataFrame) DataFrame[source]¶
Pool two tables of per-cell count, mean, and sample standard deviation exactly.
Each table is indexed by
(statistic, ...), wherestatisticis"mean","std_dev"(the sample standard deviation,ddof=1), or"n"(the number of observations), aligned cell by cell. The pooled result is what a single accumulator would have reported had it observed every observation of both: counts add, means are count-weighted, and sums of squared deviations add with the usual correction for the difference between the means.A cell observed once has no standard deviation but contributes zero to the pooled sum of squared deviations. A cell with no observations contributes nothing. A cell present in only one table is passed through unchanged.