Created
March 1, 2012 17:42
-
-
Save ptone/1951617 to your computer and use it in GitHub Desktop.
Convert from Paychex Preview time0002 format to CSV delimited
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
from collections import defaultdict | |
data_file = '/Users/preston/Dropbox/data/A8306701_ta.txt' | |
emp_data = defaultdict(lambda: defaultdict(float)) | |
for line in open(data_file, 'r'): | |
data = line.split() | |
if len(data) != 3: | |
# print line | |
continue | |
employee_id, code, amount = line.split() | |
emp_data[employee_id][code] += float(amount) | |
for employee_id, times in emp_data.items(): | |
print "{0},{1},{2}".format(employee_id, times['E1'], times['E2']) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment