Last active
January 3, 2017 10:27
-
-
Save anddam/33cbe7b7596437fcec8f70591dfd5b94 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 | |
| # Read all tsv files from passed folder and average lines 469:535, take index from file name | |
| from sys import argv, exit | |
| from os import listdir | |
| from pandas import DataFrame, read_csv | |
| from datetime import datetime | |
| try: | |
| path = argv[1] | |
| files = listdir(path) | |
| except IndexError: | |
| print("Provide a folder path as argument") | |
| exit(1) | |
| except FileNotFoundError: | |
| print("Path is not valid") | |
| exit(2) | |
| result = DataFrame(columns=['quota', 'E355S', 'E355P']) | |
| for file in files: | |
| print("Parsing file '%s'" % file) | |
| timestamp = datetime.strptime(file[26:39], '%y%m%d-%H%M%S') | |
| data = read_csv(path + file, sep=None, engine='python') | |
| mean_serie = data[469:535].mean(axis=0) | |
| # result[timestamp] = mean_serie |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment