wesbatch

Various tools that I've written mainly for use in unix/linux environments. Created to solve a specific problem I encountered at one time or another.

FixedFieldSet? - shows stats on a set of fixed field records

>>> from FixedFieldSet import *
>>> records = ['050070200707019999', '050070200708020050', '050072200710070375']
>>> fields = [FixedField('insurer_id', 0, 6, str), 
...           FixedField('date', 6, 14, str),
...           FixedField('contract_amt', 14, 18, int), 
...           ]  
...    
>>> rp = RecordParser(fields)
>>> rp.parse(records)
>>> rp.show_stats() 
<insurer_id> count:3 sum:0 avg:0 min:0 max:0
<date> count:3 sum:0 avg:0 min:0 max:0
<contract_amt> count:3 sum:10424 avg:3474 min:50 max:9999

distinct - returns the distinct entries in a list

>>> import distinct
>>> distinct.get_distincts([1,3,5,'a',3,3,5,'b'])
[1, 3, 5, 'a', 'b']

check out the code here

No comments yet, be the first to add one!
: