copy columns from dataframe to dictionary in python code example
Example 1: dataframe to dict without index
df.to_dict('list')
Example 2: dataframe to dictionary using index as key
#Use the Dataframe index as the key of the dictionary
df.to_dict('index')