Para 2D, calcule o desvio padrão em cada x
num_intervals = 3
#sort the arrays
sort_inds = np.argsort(x)
x = x[sort_inds]
y = y[sort_inds]
# create intervals
x_range = x.max() - x.min()
x_intervals = np.linspace(
np.min(x)+x_range/num_intervals,
x.max()-x_range/num_intervals,
num_intervals)
split_indices = np.unique(np.searchsorted(x, x_intervals, side='left'))
ls_of_arrays_x = np.array_split(x, split_indices)
ls_of_arrays_y = np.array_split(y, split_indices)
y_stds = np.array([np.std(yi) for yi in ls_of_arrays_y])
x_mean = np.array([np.mean(xi) for xi in ls_of_arrays_x])
Real Raccoon