Fixing `TypeError: only integer scalar arrays can be converted to a scalar index`
This will be a short post. I was trying to concatenate two numpy arrays, when I got this exception:
TypeError: only integer scalar arrays can be converted to a scalar index
I was following https://numpy.org/doc/stable/reference/generated/numpy.concatenate.html. It turned out I misread the doc, and should have passed my arrays as an array-like parameter. So the correct way to call it is:
np.concatenate([np.array([3,4]), np.array([6,7])])
==> array([3, 4, 6, 7])
Easy fix, but the error message is really hard to interpret.