def str_contains(arr, pat, case=True, flags=0, na=np.nan, regex=True):
 if regex:
  if (not case):
   flags |= re.IGNORECASE
  regex = re.compile(pat, flags=flags)
  if (regex.groups > 0):
   warnings.warn('This pattern has match groups. To actually get the groups, use str.extract.', UserWarning, stacklevel=3)
  f = (lambda x: bool(regex.search(x)))
 elif case:
  f = (lambda x: (pat in x))
 else:
  upper_pat = pat.upper()
  f = (lambda x: (upper_pat in x))
  uppered = _na_map((lambda x: x.upper()), arr)
  return _na_map(f, uppered, na, dtype=bool)
 return _na_map(f, arr, na, dtype=bool)

def str_contains ( arr , pat , case = True , flags = 0 , na = np . nan , regex = True ) : if regex : if ( not case ) : flags |= re . IGNORECASE regex = re . compile ( pat , flags = flags ) if ( regex . groups > 0 ) : warnings . warn ( 'This pattern has match groups. To actually get the groups, use str.extract.' , UserWarning , stacklevel = 3 ) f = ( lambda x : bool ( regex . search ( x ) ) ) elif case : f = ( lambda x : ( pat in x ) ) else : upper_pat = pat . upper ( ) f = ( lambda x : ( upper_pat in x ) ) uppered = _na_map ( ( lambda x : x . upper ( ) ) , arr ) return _na_map ( f , uppered , na , dtype = bool ) return _na_map ( f , arr , na , dtype = bool )
return boolean series/array whether given pattern/regex is contained in each string in the series/index .