我正在尝试为here所述的广播答案找到一个类似的解决方案,该解决方案适用于总和:
export default (state = initialState, action) => {
switch (action.type) {
case ON_VISITOR_RECORDS_FETCHED:
return state.merge({
visitorRecords: fromJS(action.visitorRecords),
});
case ON_RETURN_APPROVED:
return state.merge({
approvedBookingId: action.approvedBookingId,
});
case ON_VISITOR_RECORD_UPDATED:
return {
...state,
visitorRecords: state.visitorRecords.map((record) => {
if(record.id == action.payload.id){
return{
...record,
...action.payload
}
}
})
}
default:
return state;
}
};
如何调整此示例以使其适合scipy.stats.norm中的匹配项?它没有轴arg。
所以我要对10个组中的每一个都使用mu和std,如下所示:
import numpy as np
n = 10000
observations = np.random.uniform(low=5, high=7, size=n).reshape(-1, 1)
groups = np.random.randint(low=1, high=10, size=n)
d = np.bincount(groups, observations.sum(axis=1), 10)