def create_punchcards(user, split_interval=60):
    """
    Computes raw indicators (e.g. number of outgoing calls) for intervals of ~1 hour
    across each week of user data. These "punchcards" are returned in a nested list
    with each sublist containing [user.name, channel, weekday, section, value].

    Parameters
    ----------
    user : object
        The user to create punchcards for.
    split_interval : int
        The interval in minutes for which each indicator is computed. Defaults to 60.
        Needs to be able to split a day (24*60 minutes) evenly.
    """

    if not float(24 * split_interval / 60).is_integer():
        raise ValueError(
            "The minute interval set for the punchcard structure does not evenly divide the day!")

    contacts_in = partial(bc.individual.number_of_contacts,
                          direction='in', interaction='callandtext', summary=None)
    contacts_out = partial(bc.individual.number_of_contacts,
                           direction='out', interaction='callandtext', summary=None)
    calls_in = partial(bc.individual.number_of_interactions,
                       direction='in', interaction='call', summary=None)
    calls_out = partial(bc.individual.number_of_interactions,
                        direction='out', interaction='call', summary=None)
    texts_in = partial(bc.individual.number_of_interactions,
                       direction='in', interaction='text', summary=None)
    texts_out = partial(bc.individual.number_of_interactions,
                        direction='out', interaction='text', summary=None)
    time_spent_in = partial(bc.individual.call_duration,
                            direction='in', interaction='call', summary=None)
    time_spent_out = partial(bc.individual.call_duration,
                             direction='out', interaction='call', summary=None)

    core_func = [
        (contacts_in, "scalar"),
        (contacts_out, "scalar"),
        (calls_in, "scalar"),
        (calls_out, "scalar"),
        (texts_in, "scalar"),
        (texts_out, "scalar")
    ]

    time_func = [
        (time_spent_in, "summarystats"),
        (time_spent_out, "summarystats")
    ]

    pc = []
    sections = [
        (i + 1) * split_interval for i in range(7 * 24 * 60 / split_interval)]
    temp_user = _extract_user_info(user)

    for grouped_records in group_records(user, groupby='week'):
        week_records = list(grouped_records)
        time_spent_rec = _transform_to_time_spent(
            week_records, split_interval, sections)
        pc.extend(_calculate_channels(
            week_records, sections, split_interval, core_func, temp_user))
        pc.extend(_calculate_channels(
            time_spent_rec, sections, split_interval, time_func, temp_user, len(core_func)))

    return pc
dataset/ETHPy150Open yvesalexandre/bandicoot/bandicoot/special/punchcard.py/create_punchcards/swapped operands of `/`