pydmqmc.utils.save_report

pydmqmc.utils.save_report(list_of_dicts, basename, index_col=None, filetype='csv', pickle_protocol=None)

Save a lists of dictionaries as a chosen file type.

Parameters:
list_of_dictslist of dictionaries with strings as keys.

Data to be written to disk. Each dictionary must have identical keys.

basenamestr

Base filename (i.e., without extension) to which to write data.

index_colstring, optional

For “csv” or “txt” filetypes, name of the column to put first. Must be a key in the dictionaries in list_of_dicts. If index_col is not supplied, the first column saved to file will be arbitrary.

filetypestr, default “csv”

File type (aka extension) with which to save list_of_dicts. Supported types are:

  • “csv” : comma-separated value file

  • “txt” : text file (space-delimited)

  • “pkl” : pickle file

pickle_protocolunt, optional

Protocol version to use with pickle. If none, uses pickle’s default.

See also

save_array

Save an array as a chosen file type.