import warnings warnings.simplefilter('ignore') code example
Example 1: python suppress warnings in function
import warnings
warnings.filterwarnings("ignore")
Example 2: ignoring warnings
import warnings
warnings.filterwarnings(action= 'ignore')