Changeset 7
- Timestamp:
- 10/05/04 21:37:05
- Files:
-
- trunk/analysis.py (modified) (2 diffs)
- trunk/readme.py (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/analysis.py
r6 r7 64 64 return aggfunc 65 65 66 66 67 def COUNT(obj, current_agg_value): 67 68 """count -> an aggregate function for use with crosstab().""" … … 73 74 74 75 Example: 75 data = CrossTab(source, (lambda x: x.FirstDate.month,), 76 'Field', CrossTab.sum('Size')).results() 76 >>> f = ["a", "b", "cc", "addd", "a4", "6"] 77 >>> group = [lambda x: x.isalpha()] 78 >>> pivot = lambda x: x.startswith("a") 79 >>> ctab = analysis.CrossTab(f, groups, pivot) 80 >>> data, columns = ctab.results() 81 >>> data 82 {(True,): {False: 2, True: 2}, (False,): {False: 1, True: 1}} 83 >>> columns 84 [False, True] 77 85 """ 78 86 79 87 def __init__(self, source=[], groups=[], pivot=None, aggfunc=COUNT): 80 88 """CrossTab(source, groups, pivot, aggfunc=count) 89 90 source: a list of objects. 81 91 82 92 groups: a sequence of attribute names or callables, trunk/readme.py
r6 r7 81 81 82 82 changelog = """ 83 1.2.4 ( ):83 1.2.4 (10/4/04): 84 84 1. Allow Unit properties to be set in Unit.__init__() by **kwargs. 85 85 2. Added a convenience function to Unit for associations. That is,
