DataFrame.to_dict()

pandas.DataFrame.to_dict

DataFrame.to_dict(*args, **kwargs)

Convert DataFrame to dictionary.

Parameters:

orient : str {‘dict’, ‘list’, ‘series’, ‘split’, ‘records’, ‘index’}

Determines the type of the values of the dictionary.

  • dict (default) : dict like {column -> {index -> value}}
  • list : dict like {column -> [values]}
  • series : dict like {column -> Series(values)}
  • split : dict like {index -> [index], columns -> [columns], data -> [values]}
  • records : list like [{column -> value}, ... , {column -> value}]
  • index : dict like {ind