scipy - Python - binning Y and Z data according to binning on X data -


i have list of x, y, z values, of give snippet here:

  x     y     z 0.015 34.11 0.21 0.015 34.38 0.22 0.015 34.16 0.16 0.015 33.95 0.18 0.0151 34.53 0.21 0.0152 34.26 0.24 0.0152 34.02 0.22 0.0152 34.1 0.22 0.0153 34.71 0.21 0.0154 33.94 0.15 0.016 33.82 0.21 0.016 34.17 0.22 0.0163 34.45 0.21 0.0163 34.02 0.2 0.0163 34.04 0.14 

and on...i include sample give idea of how data like.

i binning these data, in following way. first of all, perform binning in x, using binned_statistic scipy:

from scipy.stats import binned_statistic x_bin_means = binned_statistic(x, x, bins=15, range=(0.0, 1.5))[0] 

output (keeping account of data, not snippet):

[ 0.03590114  0.15124727  0.25215231  0.34849333  0.4460193   0.55067273   0.64496471  0.74935294  0.838232    0.95084737  1.032       1.1505   1.23775     1.334625    1.414     ] 

so far good. in essence, did dividing x values in 15 bins, assigning each bin single value, equal mean of values inside bin.

now need to:

1) perform same kind of binning on y data. relatively difficult point here second binning not independent 1 on x values. indeed, need is, each x bin, first extract y values corresponding bin, , compute mean of extracted values in each bin again single value, assign newly created y bin.

2) then, need perform similar operation on z data, difference not assign mean of z values in each bin binned z values, value given by

enter image description here


Comments

Popular posts from this blog

account - Script error login visual studio DefaultLogin_PCore.js -

xcode - CocoaPod Storyboard error: -