Is there a way I can assign a not operator within a string itself when using Series.str.contains? (Not with a ~ operator.) For example:
I want cat and dog but not fox.
srStr = 'cat|dog' # input
df = pd.DataFrame({'Animals' : ['cat','dog','fox','elephant']}) # cannot change
df.Animals.str.contains(srStr) # cannot change
I want to set up srStr such that the last line of the code outputs [True,True,False,True].
I cannot use the ~ operator for inverting a temporary result because the code is already part of an architecture and I am passing srStr as an input.
 
    