I am using python 3.6 version, I am getting following error:
TypeError: an integer is required (invsf['Destn Branch'] = invsf.apply(lambda x: convloc(x['Destn Branch'])))
Code:
loclist = ['Destn Branch','Hub SC Location','Origin Branch']
maplist = dict({'MAAG': 'MAAC','NEIR': 'GAUB','RJPR': 'PTLF','SIKM': 'SILB','KLMF':'COKB','AMDE':'AMDO'})
print (loclist)
totalconsinv = len(invsf)
## Check done
def convloc(location):
get_dict = maplist.get(location)
print ('get_dict',get_dict)
if get_dict is None:
#print 'location',location
return location
else:
return get_dict
invsf['Destn Branch'] = invsf.apply(lambda x: convloc(x['Destn Branch']))
How do I fix this error?
invsf?