Skip to content

Instantly share code, notes, and snippets.

@ptone
Created March 1, 2012 17:42
Show Gist options
  • Save ptone/1951617 to your computer and use it in GitHub Desktop.
Save ptone/1951617 to your computer and use it in GitHub Desktop.
Convert from Paychex Preview time0002 format to CSV delimited
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