0

Suppose if iam having below array with min,max in the list of elemnet in the below array,it should divide into 10 chunks,

Z=array([[10, 20],
   [5, 30],
   [20, 30],
   [15, 40],
   [40, 55]]) 

it should divide 10 chunks,if we take first element of the array[10,20],so array should be divided into bucket list like this :array([[10-11],[11-12][12-13]....[19-20]]

Next time this bucket should be updated, consider next element say [5,30] where min 5 is less than 10 and max 30 is greater 20.Bucket should be update into 10 equal parts again and this needs to repeated.Bucket remains same if above condition not satisfies.

I tried using for loop, not getting the proper result.

BlueSheepToken
  • 5,751
  • 3
  • 17
  • 42
  • In your buckets, where does 11 belong? [10-11]? Or [11-12]? What happens if `(max-min-1)%10 != 0` ? – BlueSheepToken May 10 '19 at 08:59
  • Why do you mention `where min 5 is less than 10 and max 30 is greater 20`? Why is that relevant? – yatu May 10 '19 at 09:01
  • iam trying in for loop calculating the bucket list,the bucket list needs to be updated,iam giving the hint that it shuld consider that condition – ADITYA KUMAR PINJALA May 10 '19 at 09:03
  • Can you add output for, at least, `[5, 30]`? as @yatu noticed, it's not very clear why you said that – Lante Dellarovere May 10 '19 at 09:03
  • for [5,30] it shuld divide into bucket of 10 but should satisfies the previous elemnet min and max,here it satisfies so it divides into 10 buckets – ADITYA KUMAR PINJALA May 10 '19 at 09:06
  • Possible duplicate of [How do you split a list into evenly sized chunks?](https://stackoverflow.com/questions/312443/how-do-you-split-a-list-into-evenly-sized-chunks) – Katekarin May 10 '19 at 09:48

0 Answers0