@grouping(interaction='callandtext')
def percent_initiated_conversations(records):
    records = list(records)

    interactions = defaultdict(list)
    for r in records:
        interactions[r.correspondent_id].append(r)

    def _percent_initiated(grouped):
        mapped = [(1 if conv[0].direction == 'out' else 0, 1)
                  for conv in _conversations(grouped)]
        return mapped

    all_couples = [sublist for i in interactions.values()
                   for sublist in _percent_initiated(i)]

    if len(all_couples) == 0:
        init, total = 0, 0
    else:
        init, total = map(sum, zip(*all_couples))

    return float(init) / total if total != 0 else 0
An OpenDocument Spreadsheet representation of the :class:`Dataset` object, with :ref:`separators`. Cannot be set.
dataset/ETHPy150Open yvesalexandre/bandicoot/bandicoot/individual.py/percent_initiated_conversations--crossover with--dataset/ETHPy150Open cloudera/hue/desktop/core/ext-py/tablib-0.10.0/tablib/core.py/Dataset.ods