def _exception_to_nan(func):
def wrap(*a, **kw):<EOL><INDENT>try:<EOL><INDENT>return func(*a, **kw)<EOL><DEDENT>except Exception:<EOL><INDENT>return np.nan<EOL><DEDENT><DEDENT>return wrap<EOL>
Decorate function to return nan if it raises an exception