def _groups_or_na_fun(regex):
if regex.groups == <NUM_LIT:0>:<EOL><INDENT>raise ValueError("<STR_LIT>")<EOL><DEDENT>empty_row = [np.nan] * regex.groups<EOL>def f(x):<EOL><INDENT>if not isinstance(x, str):<EOL><INDENT>return empty_row<EOL><DEDENT>m = regex.search(x)<EOL>if m:<EOL><INDENT>return [np.nan if item is None else item for item in m.groups()]<EOL><DEDENT>else:<EOL><INDENT>return empty_row<EOL><DEDENT><DEDENT>return f<EOL>
Used in both extract_noexpand and extract_frame