I have an array:
arr = [
['00', '01', '02'],
['10', '11', '12'],
]
I want to reshape this array considering its indices:
reshaped = [
[0, 0, '00'],
[0, 1, '01'],
[0, 2, '02'],
[1, 0, '10'],
[1, 1, '11'],
[1, 2, '12'],
]
Is there a numpy
or pandas
way to do that? Or do I have to do the good old for
?
for x, arr_x in enumerate(arr):
for y, val in enumerate(arr_x):
print(x, y, val)