I have a long list:
input_data = [a, b, c, d, e, f, g, h, ...]
How can I to split them by their index number into:
type1. type2. type3. type4.
0. a b c d
1. e f g h
2. ...
I have a long list:
input_data = [a, b, c, d, e, f, g, h, ...]
How can I to split them by their index number into:
type1. type2. type3. type4.
0. a b c d
1. e f g h
2. ...
Try with reshape
n = 2#you can change to n = 4
out = pd.DataFrame(np.array(input).reshape((-1,n)))
Out[45]:
0 1
0 a b
1 c d