Module Import alias identifier FunctionDef arguments args NameParam defaults body Expr Str Assign NameStore ListLoad For TupleStore NameStore NameStore Call AttributeLoad NameLoad attr body Assign NameStore AttributeLoad NameLoad attr Assign NameStore AttributeLoad NameLoad attr If CompareEq NameLoad Str body AugAssignAdd NameStore ListLoad TupleLoad NameLoad Str Num orelse If CompareEq NameLoad Str body AugAssignAdd NameStore ListLoad TupleLoad NameLoad Str Num TupleLoad NameLoad Str Num orelse If CompareEq NameLoad Str body AugAssignAdd NameStore ListLoad TupleLoad NameLoad Str Num orelse If CompareEq NameLoad Str body AugAssignAdd NameStore ListLoad TupleLoad NameLoad Str Num TupleLoad NameLoad Str Num orelse If CompareEq NameLoad Str body If NameLoad body AugAssignAdd NameStore ListLoad TupleLoad NameLoad Str Num TupleLoad NameLoad Str Num orelse AugAssignAdd NameStore ListLoad TupleLoad NameLoad Str Num TupleLoad NameLoad Str Num orelse Assert Num Expr Str Return Call AttributeLoad NameLoad attr NameLoad keyword ListLoad Str Str Str decorator_list
N/A N/A pandas pd process_mandatory_tours N/A N/A persons N/A N/A N/A 
    This method processes the mandatory_tour_frequency column that comes out of
    the model of the same name and turns into a DataFrame that represents the
    mandatory tours that were generated

    Parameters
    ----------
    persons : DataFrame
        Persons is a DataFrame which has a column call
        mandatory_tour_frequency (which came out of the mandatory tour
        frequency model) and a column is_worker which indicates the person's
        worker status.  The only valid values of the mandatory_tour_frequency
        column to take are "work1", "work2", "school1", "school2" and
        "work_and_school"

    Returns
    -------
    tours : DataFrame
        An example of a tours DataFrame is supplied as a comment in the
        source code - it has an index which is a tour identifier, a person_id
        column, a tour_type column which is "work" or "school" and a tour_num
        column which is set to 1 or 2 depending whether it is the first or
        second mandatory tour made by the person.  The logic for whether the
        work or school tour comes first given a "work_and_school" choice
        depends on the is_worker column and was copied from the original
        implementation.
     N/A tours N/A N/A N/A key row N/A N/A persons iterrows N/A N/A mtour N/A row mandatory_tour_frequency N/A is_worker N/A row is_worker N/A N/A mtour work1 N/A N/A tours N/A N/A key work 1 N/A N/A N/A mtour work2 N/A N/A tours N/A N/A key work 1 N/A key work 2 N/A N/A N/A mtour school1 N/A N/A tours N/A N/A key school 1 N/A N/A N/A mtour school2 N/A N/A tours N/A N/A key school 1 N/A key school 2 N/A N/A N/A mtour work_and_school N/A N/A is_worker N/A N/A tours N/A N/A key work 1 N/A key school 2 N/A N/A tours N/A N/A key school 1 N/A key work 2 N/A N/A 0 N/A 
    Pretty basic at this point - trip table looks like this so far
           person_id tour_type tour_num
    0          4419    work     1
    1          4419    school   2
    4          4650    school   1
    5         10001    school   1
    6         10001    work     2
     N/A N/A N/A pd DataFrame tours columns N/A person_id tour_type tour_num N/A