def _create_data_grouping(data, source_columns, time_column, group_by, color):
    if (not source_columns):
        data_columns = set(['NewProcessName', 'EventID', 'CommandLine'])
    else:
        data_columns = set(source_columns)
    tool_tip_columns = data_columns.copy()
    data_columns.add(time_column)
    if group_by:
        group_count_df = data[[group_by, time_column]].groupby(group_by).count().reset_index().rename(columns={time_column: 'count'})
        group_count_df['y_index'] = group_count_df.index
        series_count = len(group_count_df)
        (colors, palette_size) = _get_color_palette(series_count)
        group_count_df['color'] = group_count_df.apply((lambda x: colors[(x.y_index % palette_size)]), axis=1)
        data_columns.update([group_by, 'y_index', 'color'])
        clean_data = data.drop(columns=['y_index', 'color'], errors='ignore')
        graph_df = clean_data.merge(group_count_df, on=group_by)[list(data_columns)]
    else:
        graph_df = data[list(data_columns)].copy()
        graph_df['color'] = color
        graph_df['y_index'] = 1
        series_count = 1
        group_count_df = None
    return (graph_df, group_count_df, tool_tip_columns, series_count)
def _create_data_grouping(data, source_columns, time_column, group_by, color):
    if (not source_columns):
        data_columns = set(['NewProcessName', 'EventID', 'CommandLine'])
    else:
        data_columns = set(source_columns)
    tool_tip_columns = data_columns.copy()
    data_columns.add(time_column)
    if group_by:
        group_count_df = data[[group_by, time_column]].groupby(group_by).count().reset_index().rename(columns={time_column: 'count'})
        group_count_df['y_index'] = group_count_df.index
        series_count = len(group_count_df)
        (colors, palette_size) = _get_color_palette(series_count)
        group_count_df['color'] = group_count_df.apply((lambda x: colors[(x.y_index % palette_size)]), axis=1)
        data_columns.update([group_by, 'y_index', 'color'])
        clean_data = data.drop(columns=['y_index', 'color'], errors='ignore')
        graph_df = clean_data.merge(group_count_df, on=group_by)[list(data_columns)]
    else:
        graph_df = data[list(data_columns)].copy()
        graph_df['color'] = color
        graph_df['y_index'] = 1
        series_count = 1
        group_count_df = None
    return (graph_df, group_count_df, tool_tip_columns, series_count)