Why does numpy returns an empty array when you subset an array with indices higher than the shape of the array? is this somewhat a bug or what is the advantage of this? I would expect an error message, like the one you get if you try to plot an index out of bounds. Example:
>>> import numpy as np
>>> from matplotlib import pyplot as plt
>>> a = np.array([[1, 2, 3], [4, 5, 6]])
>>> np.shape(a)
(2, 3)
This obviously makes no sense, since a is an array with 3 columns, but instead of returning an error message, you get an empty array, and furthermore, you can do operations with it:
>>> (a[:, 44:55])
array([], shape=(2, 0), dtype=int64)
>>> np.sum(a[:, 44:55], 1)
array([0, 0])
What is the advantage of this? I just cannot see the use of it. Is there a way to prevent this from happening?