I envision something like
import numpy as np
x = np.arange(10)
for i, j in x:
print(i,j)
and get something like
0 1
2 3
4 5
6 7
8 9
But I get this traceback:
Traceback (most recent call last):
File "/home/andreas/.local/share/JetBrains/Toolbox/apps/PyCharm-P/ch-0/223.8214.51/plugins/python/helpers/pydev/pydevconsole.py", line 364, in runcode
coro = func()
File "<input>", line 1, in <module>
TypeError: cannot unpack non-iterable numpy.int64 object
I also tried to use np.nditer(x) and itertools with zip(x[::2], x[1::2]), but that does not work either, with different error messages.
This should be super simple, but I can't find solutions online.