Let's say I have a numpy array :
a = np.array([10,11,12,13,22,23,24,25,30,31,32,33,34])
I would like to create sub-arrays which contain elements for which the difference is equal to 1
I tried to look for indices where the difference is greater than 1 with
c = np.where(a[1:]-a[:-1]>1)
In this case the result will be
array1=np.array([10,11,12])
array2=np.array([22,23,24,25])
array3=np.array([30,31,32,33,34])
But I do not know how to do that because the number of sub-arrays can change
Any idea ?