1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60
|
pstat.py module
#################################################
####### Written by: Gary Strangman ###########
####### Last modified: Jun 29, 2001 ###########
#################################################
This module provides some useful list and array manipulation routines
modeled after those found in the |Stat package by Gary Perlman, plus a
number of other useful list/file manipulation functions. The list-based
functions include:
abut (source,*args)
simpleabut (source, addon)
colex (listoflists,cnums)
collapse (listoflists,keepcols,collapsecols,fcn1=None,fcn2=None,cfcn=None)
dm (listoflists,criterion)
flat (l)
linexand (listoflists,columnlist,valuelist)
linexor (listoflists,columnlist,valuelist)
linedelimited (inlist,delimiter)
lineincols (inlist,colsize)
lineincustcols (inlist,colsizes)
list2string (inlist)
makelol(inlist)
makestr(x)
printcc (lst,extra=2)
printincols (listoflists,colsize)
pl (listoflists)
printl(listoflists)
replace (lst,oldval,newval)
recode (inlist,listmap,cols='all')
remap (listoflists,criterion)
roundlist (inlist,num_digits_to_round_floats_to)
sortby(listoflists,sortcols)
unique (inlist)
duplicates(inlist)
writedelimited (listoflists, delimiter, file, writetype='w')
Some of these functions have alternate versions which are defined only if
Numeric (NumPy) can be imported. These functions are generally named as
above, with an 'a' prefix.
aabut (source, *args)
acolex (a,indices,axis=1)
acollapse (a,keepcols,collapsecols,sterr=0,ns=0)
adm (a,criterion)
alinexand (a,columnlist,valuelist)
alinexor (a,columnlist,valuelist)
areplace (a,oldval,newval)
arecode (a,listmap,col='all')
arowcompare (row1, row2)
arowsame (row1, row2)
asortrows(a,axis=0)
aunique(inarray)
aduplicates(inarray)
Currently, the code is all but completely un-optimized. In many cases, the
array versions of functions amount simply to aliases to built-in array
functions/methods. Their inclusion here is for function name consistency.
|