def merge_rows(self, key, merge_scalars=True):
        """
        Uses key as a unique index an merges all duplicates rows.  Use
        cast_column to modify types of columns before merging to affect
        behavior of duplicate rectification.

        Args:
            key: row to merge on
            merge_scalars: if True, scalar values become lists


        Example:
            >>> # DISABLE_DOCTEST
            >>> from utool.util_dev import *  # NOQA
            >>> import utool as ut
            >>> key_to_list = {
            >>>     'uuid': [1, 1, 2, 3, 4, 2, 1],
            >>>     'a':    [1, 2, 3, 4, 5, 6, 7],
            >>>     'b':    [[1], [2], [3], [4], [5], [6], [7]],
            >>>     'c':    [[1], [1], [2], [3], [4], [2], [1]],
            >>> }
            >>> self = ColumnLists(key_to_list)
            >>> key = 'uuid'
            >>> newself = self.merge_rows('uuid')
            >>> print(newself.to_csv())
            #             a,            c,            b,         uuid
                          4,          [3],          [4],            3
                          5,          [4],          [5],            4
                "[1, 2, 7]",  "[1, 1, 1]",  "[1, 2, 7]",  "[1, 1, 1]"
                   "[3, 6]",     "[2, 2]",     "[3, 6]",     "[2, 2]"

        """
        import utool as ut
        unique_labels, groupxs = self.group_indicies(key)
        single_xs = [xs for xs in groupxs if len(xs) == 1]
        multi_xs = [xs for xs in groupxs if len(xs) > 1]
        singles = self.take(ut.flatten(single_xs))
        multis = [self.take(idxs) for idxs in multi_xs]

        merged_groups = []
        for group in multis:
            newgroup = {}
            for key_ in group.keys():
                val = group[key_]
                if key_ == key:
                    # key_ was garuenteed unique
                    val_ = val[0]
                elif hasattr(val[0].__class__, 'union'):
                    # HACK
                    # Sets are unioned
                    val_ = ut.oset.union(*val)
                elif isinstance(val[0], (ut.oset,)):
                    # Sets are unioned
                    val_ = ut.oset.union(*val)
                elif isinstance(val[0], (set)):
                    # Sets are unioned
                    val_ = set.union(*val)
                elif isinstance(val[0], (tuple, list)):
                    # Lists are merged together
                    val_ = ut.flatten(val)
                    #val_ = ut.unique(ut.flatten(val))
                else:
                    if ut.allsame(val):
                        # Merge items that are the same
                        val_ = val[0]
                    else:
                        if merge_scalars:
                            # If mergeing scalars is ok, then
                            # Values become lists if they are different
                            val_ = val
                        else:
                            if True:
                                # If there is only one non-none value then use that.
                                other_vals = ut.filter_Nones(val)
                                if len(other_vals) == 1:
                                    val_ = val[0]
                                else:
                                    raise ValueError(
                                        'tried to merge a scalar in %r, val=%r' % (
                                            key_, val))
                            else:
                                # If merging scalars is not ok, then
                                # we must raise an error
                                raise ValueError(
                                    'tried to merge a scalar in %r, val=%r' % (
                                        key_, val))
                newgroup[key_] = [val_]
            merged_groups.append(ut.ColumnLists(newgroup))
        merged_multi = self.__class__.flatten(merged_groups)
        merged = singles + merged_multi
        return merged
Uses key as a unique index an merges all duplicates rows.  Use
        cast_column to modify types of columns before merging to affect
        behavior of duplicate rectification.

        Args:
            key: row to merge on
            merge_scalars: if True, scalar values become lists


        Example:
            >>> # DISABLE_DOCTEST
            >>> from utool.util_dev import *  # NOQA
            >>> import utool as ut
            >>> key_to_list = {
            >>>     'uuid': [1, 1, 2, 3, 4, 2, 1],
            >>>     'a':    [1, 2, 3, 4, 5, 6, 7],
            >>>     'b':    [[1], [2], [3], [4], [5], [6], [7]],
            >>>     'c':    [[1], [1], [2], [3], [4], [2], [1]],
            >>> }
            >>> self = ColumnLists(key_to_list)
            >>> key = 'uuid'
            >>> newself = self.merge_rows('uuid')
            >>> print(newself.to_csv())
            #             a,            c,            b,         uuid
                          4,          [3],          [4],            3
                          5,          [4],          [5],            4
                "[1, 2, 7]",  "[1, 1, 1]",  "[1, 2, 7]",  "[1, 1, 1]"
                   "[3, 6]",     "[2, 2]",     "[3, 6]",     "[2, 2]"