def _generate_stat_rows(data, group, comparison, operation, p, ptype, node=None):
    """
    Generates dictionaries with necessary data for the pandas dataframes.
    :param data: Pandas data
    :param group: Name for grouping NetworkX objects
    :param comparison: Network name of comparison
    :param operation: Difference and/or intersection
    :param p: p value
    :param ptype: Type of graph property that is being compared
    :param node: Name of node
    :return: Pandas dataframe with new rows
    """
    new_row = {'Group': group,
               'Comparison': comparison,
               'Measure': operation,
               'P': p,
               'P.type': ptype}
    if node:
        new_row['Node'] = node
    data = data.append(new_row, ignore_index=True)
    return data