Contact: fumanchu@aminus.org

Log in as guest/dejavu to create tickets

I think I've seen this ORM somewhere before...

Changeset 7

Show
Ignore:
Timestamp:
10/05/04 21:37:05
Author:
fumanchu
Message:

Made the example CrossTab? more real-world

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/analysis.py

    r6 r7  
    6464    return aggfunc 
    6565 
     66 
    6667def COUNT(obj, current_agg_value): 
    6768    """count -> an aggregate function for use with crosstab().""" 
     
    7374     
    7475    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] 
    7785    """ 
    7886     
    7987    def __init__(self, source=[], groups=[], pivot=None, aggfunc=COUNT): 
    8088        """CrossTab(source, groups, pivot, aggfunc=count) 
     89         
     90        source: a list of objects. 
    8191         
    8292        groups: a sequence of attribute names or callables, 
  • trunk/readme.py

    r6 r7  
    8181 
    8282changelog = """ 
    83 1.2.4 (): 
     831.2.4 (10/4/04): 
    8484    1. Allow Unit properties to be set in Unit.__init__() by **kwargs. 
    8585    2. Added a convenience function to Unit for associations. That is,