Skip to content

Instantly share code, notes, and snippets.

@blazetopher
Last active December 10, 2015 22:29
Show Gist options
  • Save blazetopher/4502729 to your computer and use it in GitHub Desktop.
Save blazetopher/4502729 to your computer and use it in GitHub Desktop.
Convert data output from process monitor webapp to csv
def monitor_dict_to_csv(data_dict, outfile):
import csv, os
if isinstance(data_dict, str) and os.path.exists(data_dict):
import json
data_dict = json.load(open(data_dict))
if os.path.exists(outfile):
os.remove(outfile)
with open(outfile, 'a') as f:
writer = csv.writer(f)
vals = data_dict['values']
for x in vals:
writer.writerow(x)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment