 1

# up and down must be >= 1

Package:
scipy 8546
Exception Class:
ValueError

## Raise code

``````    if up != int(up):
raise ValueError("up must be an integer")
if down != int(down):
raise ValueError("down must be an integer")
up = int(up)
down = int(down)
if up < 1 or down < 1:
raise ValueError('up and down must be >= 1')
if cval is not None and padtype != 'constant':

# Determine our up and down factors
# Use a rational approximation to save computation time on really long
# signals
g_ = math.gcd(up, down)``````
😲 Agile task management is now easier than calling a taxi. #Tracklify

## Ways to fix 2 The arguments `up` and `down `which are used to specify the  upsampling and downsampleing factors shouldn't be less than 1.

```from scipy import signal
import numpy as np
x = np.linspace(0, 10, 20, endpoint=False)
y = np.cos(-x**2/6.0)
f_poly = signal.resample_poly(y, 0, 0)
print(f_poly)
```

```---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
<ipython-input-9-091a8b41d176> in <module>()  3 x = np.linspace(0, 10, 20, endpoint=False)  4 y = np.cos(-x**2/6.0) ----> 5 f_poly = signal.resample_poly(y, 0, 0)  6 print(f_poly)
/usr/local/lib/python3.7/dist-packages/scipy/signal/signaltools.py in resample_poly(x, up, down, axis, window, padtype, cval)  3060 down = int(down)  3061 if up < 1 or down < 1: -> 3062 raise ValueError('up and down must be >= 1')  3063 if cval is not None and padtype != 'constant':  3064 raise ValueError('cval has no effect when padtype is ', padtype)
ValueError: up and down must be >= 1
```

Fixed version of the code:

```from scipy import signal
import numpy as np
x = np.linspace(0, 10, 20, endpoint=False)
y = np.cos(-x**2/6.0)
f_poly = signal.resample_poly(y, 100, 20)
print(f_poly)
```