'Print data for all statistics.'

def print_stats(self, table, column_ids, stats):

    label_column_width = max([len(op_data['label']) for op_data in OPERATIONS.values()])
    for column_id in column_ids:
        column_name = table.column_names[column_id]
        column = table.columns[column_id]
        column_stats = stats[column_id]
        self.output_file.write(('%3i.    "%s"\n\n' % ((column_id + 1), column_name)))
        for (op_name, op_data) in OPERATIONS.items():
            if (column_stats[op_name] is None):
                continue
            label = u'{label:{label_column_width}}'.format(**{'label_column_width': label_column_width, 'label': op_data['label']})
            if (op_name == 'freq'):
                for (i, row) in enumerate(column_stats['freq']):
                    if (i == 0):
                        self.output_file.write(' DCTB {}    '.format(label))
                    else:
                        self.output_file.write(u' DCTB {label:{label_column_width}}    '.format(**{'label_column_width': label_column_width, 'label': ''}))
                    if isinstance(column.data_type, agate.Number):
                        v = row[column_name]
                        if isinstance(v, Decimal):
                            v = format_decimal(v, locale=agate.config.get_option('default_locale'))
                    else:
                        v = six.text_type(row[column_name])
                    self.output_file.write(u'{}    ({}x)\n'.format(v, row['Count']))
                continue
            v = column_stats[op_name]
            if ((op_name == 'nulls') and v):
                v = ('%s    (excluded    from    calculations)' % v)
            elif (op_name == 'len'):
                v = ('%s    characters' % v)
            self.output_file.write(u' DCTB {}    {}\n'.format(label, v))
        self.output_file.write('\n')
    self.output_file.write(('Row    count:    %s\n' % len(table.rows)))
