i am trying to apply the custome function on pandas dataframe and its not working.
it giving me an error
AttributeError: 'str' object has no attribute 'str'
def f_MI(DF):
if DF['AccNo'] == DF['Map_AccNo']:
return -1
else:
if DF['AccNo'].str.lower().str[:3] == DF['Map_MainDesc'].str.lower().str[:3]:
return 1
else:
return 0
z2['Inter_Type'] = z2.apply(f_MI,axis=1)