human
python pandas dataframe to dictionary
assistant
Here is some code to convert pandas DataFrame `df` to a dictionary using `id` field as the key

df.set_index('id').to_dict()

#Warning: this code generation is experimental. Please inspect the code for any bugs before executing.