python raise warning code example
Example 1: jupyter ignore warnings
import warnings
warnings.filterwarnings('ignore')
Example 2: ignore warnings python
import warnings
warnings.filterwarnings("ignore")
Example 3: python suppress warnings in function
import warnings
def fxn():
warnings.warn("deprecated", DeprecationWarning)
with warnings.catch_warnings():
warnings.simplefilter("ignore")
fxn()