How to ignore warnings and ignore some error steps?

  Python

Ignore warnings

# Ignore warnings
import sys
import warnings
if not sys.warnoptions:
    warnings.simplefilter('ignore')

Ignore some errors

# function FN does not work when there are nan in X
            try:
                mktest=FN(X)
                trend=mktest

            except:
                trend=np.nan

From my original code:Indexes_ERA5_GreatLakesRegion_sens_slope.ipynb