I apologize ahead if my question is very basic. I'm still new to python. I have the code snippet where Len(cls) is 27 and I want to split this len=27 array into an array of arrays each of len=3. The code snippet below splits it into an array of shape (9,3) but I would like an array of shape (3,3,3). Is there a way to do this? Thanks
new_cls_list=[]
for j in range(len(cls)):
new_cls_list_1=[]
k=0
while k<len(cls[j]):
new_cls_list_1.append(cls[j][k:k+3])
k+=3
new_cls_list.append(new_cls_list_1)