Suppose I have this NumPy array:
a = np.array([0, 3, 5, 5, 0, 10, 14, 15, 56, 0, 12, 23, 45, 23, 12, 45,
0, 1, 0, 2, 3, 4, 0, 0 ,0])
I would like to print all the numbers between 0s and automatically add them to a new np.array
(see below):
a1=[3, 5, 5]
a2=[10, 14, 15, 56]
a3=[12, 23, 45, 23, 12, 45]
a4=[1]
a5=[2, 3, 4]
Is there a built-in function to do this?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…