I have a Pandas DataFrame with a key attribute and other categorical attributes. How can I encode the categorical attributes using the 'dictionary' in this excel file?
I created the excel file, but you need just to read that using read_excel
.
Based on the comments:
def autodic(string):
temp = string.replace(';', '",').replace(':', ':"')
temp = '{' temp '"' '}'
return eval(temp)