'Cannot import name 'threshold' from scipy.stats

I am trying to use function threshold from scipy package.

from scipy.stats import threshold
I_t=threshold(I, threshmin=2, threshmax=400, newval=-1) # I is an array containing image data

However, i am getting an error message saying

cannot import name 'threshold' from 'scipy.stats'



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source