human
Pandas DataFrame to List of Dictionaries
assistant
Here is some code to convert dataframe `df` to list of dictionaries including the index values

df.to_dict('index')

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