array([ 0. , 1.25, 1.25, 2.5 , 2.5 , 3.75, 3.75, 5. ])
if n != int(n) or n < 0:
raise ValueError("n = %s is not valid. "
"n must be a nonnegative integer." % n)
After Change
array([ 0. , 1.25, 1.25, 2.5 , 2.5 , 3.75, 3.75, 5. ])
n = operator.index(n)
if n < 0:
raise ValueError("n = %s is not valid. "
"n must be a nonnegative integer." % n)