def make_users_events_table(event_col_names, all_cols):
    """event_col_names is a list of all the column names that represent events
    (these can be alpha or numeric). This function assumes that all_cols has 
    already been sorted, merged, had voided records excluded, etc."""
    event_cols = all_cols.select(*event_col_names)
    rows = iterate_user_events(all_cols.user_id, event_cols)
    return ColumnGroup.from_rows(["user_id", "event_id", "value"], rows)
def make_users_events_table(event_col_names, all_cols):
    """event_col_names is a list of all the column names that represent events
    (these can be alpha or numeric). This function assumes that all_cols has 
    already been sorted, merged, had voided records excluded, etc."""
    event_cols = all_cols.select(*event_col_names)
    rows = iterate_user_events(all_cols.user_id, event_cols)
    return ColumnGroup.from_rows(["user_id", "event_id", "value"], rows)
def make_events_table(event_headers):
    """The column names are of the format "Friday Dinner #123123". We want to 
    take all the column names and make a table of event ids and descriptions"""
    events = [
        parse_event_header(header) for header in event_headers
        if is_event_header(header)
    ]
    return ColumnGroup.from_rows(["event_id", "name"], sorted(events))
def non_harris_event_cols(class_year, num_rows):
    """Add columns for non-Harris events. These can be auto-populated if Harris
    package events include them (look in config.py). They are initialized to all
    blank."""
    blank_col = DataColumn.init_with(num_rows, '')
    return ColumnGroup([
        (format_as_event_header(event_id, "NH"), blank_col)
        for event_id in config.non_harris_events_for_year(class_year)
    ])
def parse_doc(infile):
    return ColumnGroup.from_csv(infile, 
                                delimiter="\t",
                                force_unique_col_names=True,
                                encoding="latin-1")
def make_events_table(event_headers):
    """The column names are of the format "Friday Dinner #123123". We want to 
    take all the column names and make a table of event ids and descriptions"""
    events = [parse_event_header(header) 
              for header in event_headers if is_event_header(header)]
    return ColumnGroup.from_rows(["event_id", "name"], sorted(events))
def parse_doc(infile):
    return ColumnGroup.from_csv(infile,
                                delimiter="\t",
                                force_unique_col_names=True,
                                encoding="latin-1")