def _str_extract_frame(arr, pat, flags=0):
 from pandas import DataFrame
 regex = re.compile(pat, flags=flags)
 groups_or_na = _groups_or_na_fun(regex)
 names = dict(zip(regex.groupindex.values(), regex.groupindex.keys()))
 columns = [names.get((1 + i), i) for i in range(regex.groups)]
 if (len(arr) == 0):
  return DataFrame(columns=columns, dtype=object)
 try:
  result_index = arr.index
 except AttributeError:
  result_index = None
 return DataFrame([groups_or_na(val) for val in arr], columns=columns, index=result_index, dtype=object)

def _str_extract_frame ( arr , pat , flags = 0 ) : from pandas import DataFrame regex = re . compile ( pat , flags = flags ) groups_or_na = _groups_or_na_fun ( regex ) names = dict ( zip ( regex . groupindex . values ( ) , regex . groupindex . keys ( ) ) ) columns = [ names . get ( ( 1 + i ) , i ) for i in range ( regex . groups ) ] if ( len ( arr ) == 0 ) : return DataFrame ( columns = columns , dtype = object ) try : result_index = arr . index except AttributeError : result_index = None return DataFrame ( [ groups_or_na ( val ) for val in arr ] , columns = columns , index = result_index , dtype = object )
for each subject string in the series .