Created
January 13, 2016 05:41
-
-
Save kenkoooo/4640699ae300ac05d067 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
# coding: UTF-8 | |
import pandas as pd | |
import numpy as np | |
import matplotlib.pyplot as plt | |
import statsmodels.api as sm | |
import seaborn as sns | |
import json | |
import sys | |
import re | |
def plot_data(jsonData, filename): | |
graph_name = jsonData['graph_info'][0]['graph'] | |
print graph_name | |
prefix = re.compile('^.*\-' + graph_name) | |
next_name = graph_name + prefix.sub('', filename).strip() | |
m = re.match(r"(?P<f>[a-z]*\-[0-9]*\-[0-9]*\-[0-9]*)", next_name) | |
jsonData['graph_info'][0]['graph'] = m.group('f') | |
json_str = json.dumps(jsonData, sort_keys=True, indent=4) | |
f = open(filename, "w") | |
f.write(json_str) | |
f.close() | |
if __name__ == '__main__': | |
for ai in range(1, len(sys.argv)): | |
print sys.argv[ai] | |
log = open(sys.argv[ai], 'r') | |
json_data = json.load(log) | |
log.close() | |
plot_data(json_data, sys.argv[ai]) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment