1

# interpolation can only be 'linear', 'lower' 'higher', 'midpoint', or 'nearest'

Package:
numpy
18118
Exception Class:
ValueError

## Raise code

`````` interpolation == 'midpoint':
indices = 0.5 * (floor(indices) + ceil(indices))
elif interpolation == 'nearest':
indices = around(indices).astype(intp)
elif interpolation == 'linear':
pass  # keep index as fraction and interpolate
else:
raise ValueError(
"interpolation can only be 'linear', 'lower' 'higher', "
"'midpoint', or 'nearest'")

# The dimensions of `q` are prepended to the output shape, so we need the
# axis being sampled from `ap` to be first.
ap = np.moveaxis(ap, axis, 0)
del axis

if ``````
😲  Walkingbet is Android app that pays you real bitcoins for a walking. Withdrawable real money bonus is available now, hurry up! 🚶

## Ways to fix

1

print("\tmax" + str (df(data).max()))

print("\tmin" + str (df(data).min()))

print()

Nov 25, 2022
1

Invalid value of `interpolation.`

## Reproducing the error:

```pipenv install numpy
```

```import numpy as np
a = np.array([[10, 7, 4], [3, 2, 1]])
result = np.quantile(a, 0.5,interpolation="linar")
print(result)
```

## The error:

```---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
<ipython-input-49-d479b5c19f3b> in <module>()
2
3 a = np.array([[10, 7, 4], [3, 2, 1]])
----> 4 result = np.quantile(a, 0.5,interpolation="linar")
5 print(result)

<__array_function__ internals> in quantile(*args, **kwargs)

/usr/local/lib/python3.7/dist-packages/numpy/lib/function_base.py in quantile(a, q, axis, out, overwrite_input, interpolation, keepdims)
3843         raise ValueError("Quantiles must be in the range [0, 1]")
3844     return _quantile_unchecked(
-> 3845         a, q, axis, out, overwrite_input, interpolation, keepdims)
3846
3847

/usr/local/lib/python3.7/dist-packages/numpy/lib/function_base.py in _quantile_unchecked(a, q, axis, out, overwrite_input, interpolation, keepdims)
3851     r, k = _ureduce(a, func=_quantile_ureduce_func, q=q, axis=axis, out=out,
3852                     overwrite_input=overwrite_input,
-> 3853                     interpolation=interpolation)
3854     if keepdims:
3855         return r.reshape(q.shape + k)

/usr/local/lib/python3.7/dist-packages/numpy/lib/function_base.py in _ureduce(a, func, **kwargs)
3427         keepdim = (1,) * a.ndim
3428
-> 3429     r = func(a, **kwargs)
3430     return r, keepdim
3431

/usr/local/lib/python3.7/dist-packages/numpy/lib/function_base.py in _quantile_ureduce_func(a, q, axis, out, overwrite_input, interpolation, keepdims)
3912     else:
3913         raise ValueError(
-> 3914             "interpolation can only be 'linear', 'lower' 'higher', "
3915             "'midpoint', or 'nearest'")
3916

ValueError: interpolation can only be 'linear', 'lower' 'higher', 'midpoint', or 'nearest'
```

## Fixed version:

```import numpy as np
a = np.array([[10, 7, 4], [3, 2, 1]])
result = np.quantile(a, 0.5,interpolation="linear")
print(result)
```

## Output:

```3.5
```

Jul 31, 2021
kellemnegasi 31.6k