I have a csv that looks like
AccountExternalID Customer
1 RogerInc
2 FredLLC
I am turning that into a Pandas DF, and I want to turn that into a dict that looks like
{'RogerInc': 1, 'FredLLC': 2}
This is what I tried;
def build_custid_dict(csv_path: str=None) -> dict[str]:
csv_path = r'\\path\CustomerIDs.csv'
df = pd.read_csv(csv_path)
# Strip whitespace
df[df.columns] = df.apply(lambda x: x.str.strip())
df_dict = df.to_dict('list')
return df_dict