I have an Excel table where Column A is a list of emails and column B is a customer ID.
I need to create a Python dictionary and have key=email address
and value = customer ID
.
Desired results:
dict = {email@domain.com :'customer ID'}
My code is below:
import pandas as pd
excel = "excel_file.xlsx"
list_dict = pd.read_excel(excel, index_col=0).to_dict()
print list_dict
However the dictionary is printing like this:
{u'customer ID': {u'email@domain.com': u'customer ID}}
What am I doing wrong here?