I have a class task to resize an array to [0,1] ie. so that the smallest number becomes 0 and largest 1.
It seems to not like the 0, as whenever there is a 0 in the code it spits out an empty array, but doing e.g [5,1] works. The output is this for [0,1]:
array([], shape=(0, 1), dtype=int64)
Is there any way to make it work? Profs have said it's right and are unsure why it's not working. Collab is the env.
test = [0,1,2,3,4,5]
arr1 = np.array(test)
def rescale(a):
"""Return the rescaled version of a on the [0,1] interval."""
a = (np.resize(a,[0, 1]))
return a
print(a)
rescale(arr1)