2017-09-23 Turn warnings into errors¶

The following code turns warnings into errors. Useful to find the source of a warning.

with warnings.catch_warnings():
    from pandas import DataFrame

Another one to remove annoying warnings which happen sometimes when a module is imported not at the beginning of a file:

with warnings.catch_warnings():
    warnings.filterwarnings("ignore", category=ImportWarning)
    import pandas