DataFrame.to_dict()

DataFrame.to_dict(orient='dict') [source]

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 {index -> {column -> value}}

    New in version 0.17.0.

Abbreviations are allowed. s indicates series and sp indicates split.

Returns:

result : dict like {column -> {index -> value}}

doc_Pandas
2017-01-12 04:46:41
Comments
Leave a Comment

Please login to continue.