X-Git-Url: https://projects.mako.cc/source/matplotlib-cdsw/blobdiff_plain/224a19e5f73433a38828d6bd8a655fce7c220058..HEAD:/load_hp_data.py diff --git a/load_hp_data.py b/load_hp_data.py index 85cf142..55d497c 100644 --- a/load_hp_data.py +++ b/load_hp_data.py @@ -16,8 +16,16 @@ for fieldname in reader.fieldnames: rows = [] for row in reader: - # Convert timestamp from a string to a date: - row['timestamp'] = datetime.strptime(row['timestamp'], '%Y-%m-%d %H:%M:%S') - rows.append(row) - for fieldname, value in row.items(): - columns[fieldname].append(value) \ No newline at end of file + # Convert timestamp from a string to a date: + row['timestamp'] = datetime.strptime(row['timestamp'], '%Y-%m-%d %H:%M:%S') + # Convert size from a string to an integer: + row['size'] = int(row['size']) + rows.append(row) + +# Sort these things, so that they give you nice ordered time-series +sort_rows = sorted(rows, key=lambda row: row['timestamp'], reverse=False) + +rows = sort_rows +for row in sort_rows: + for fieldname, value in row.items(): + columns[fieldname].append(value)