I am trying to create a new variable based off of an existing variable in my df. I have run into this error before and I would like to know what I am doing wrong.
Code:
def DEMO2(a):
if a['DEMO']=='02-05C':
return 'P 02-11'
elif a['DEMO']=='65+M':
return 'P 55-99'
merge_df['DEMO2']=merge_df.apply('DEMO2', axis=1)
TypeError: ("'str' object is not callable", 'occurred at index 0')
I feel like there is an obvious answer that I am missing...