Group non-tick Tuples into batches by ``group_key``.

        .. warning::
            This method should **not** be overriden.  If you want to tweak
            how Tuples are grouped into batches, override ``group_key``.
765153
def process(self, tup):
        
        # Append latest Tuple to batches
        group_key = self.group_key(tup)
        self._batches[group_key].append(tup)
597077
def grouper(n, iterable, fillvalue=None):
    ""
    args = [iter(iterable)] * n
    return zip_longest(fillvalue=fillvalue, *args)
79827
def current_batch(self):
        
        current_batch = memcache.get(self.group_key)

        if not current_batch:
            memcache.add(self.group_key, 1)
            current_batch = 1

        return current_batch
1021831
def group_by(self, *columns):
        
        for column in columns:
            self.groups.append(column)

        return self
172193
def group_by(self, *args):
        
        if len(args) == 1:
            self.raw_fields_group = args[0].split(',')
        else:
            self.raw_fields_group = list(args)
        return self
1030753
def bulk_update_batches(aggregations)
      en = Enumerator.new do |e|
        i = 1
        batch = []
        aggregations.each do |agg|
          batch << agg
          if i % @bulk_update_size == 0
            e.yield batch
            batch = []
          end
          i += 1
        end
        e.yield batch if batch.count > 0  # last one
      end
      en.lazy
    end
135808
def delete_multi(self, keys):
        
        if not keys:
            return

        # We allow partial keys to attempt a delete, the backend will fail.
        current = self.current_batch
        in_batch = current is not None

        if not in_batch:
            current = self.batch()
            current.begin()

        for key in keys:
            current.delete(key)

        if not in_batch:
            current.commit()
327050
def grouper(iterable, n):
    ''''''
    args = [iter(iterable)] * n
    for group in izip_longest(fillvalue=None, *args):
        group = [g for g in group if g != None]
        yield group
260293
def groupby(self, by=None, **kwargs):
        
        if by is None:
            by = self.plydata_groups

        # Turn off sorting by groups messes with some verbs
        if 'sort' not in kwargs:
            kwargs['sort'] = False

        return super().groupby(by, **kwargs)
505551
public static <K, V, R extends MutableMultimap<K, V>> MutableMultimap<K, V> groupBy(
            Iterable<V> iterable,
            Function<? super V, ? extends K> function,
            R concurrentMultimap,
            int batchSize)
    {
        return FJIterate.groupBy(iterable, function, concurrentMultimap, batchSize, FJIterate.FORK_JOIN_POOL);
    }
7503
def multi_groupby(self, key_fn):
        
        result_dict = defaultdict(list)

        for x in self:
            for key in key_fn(x):
                result_dict[key].append(x)

        # convert result lists into same Collection type as this one
        return {
            k: self.clone_with_new_elements(elements)
            for (k, elements)
            in result_dict.items()
        }
1150779
def _multi_blockify(tuples, dtype=None):
    

    # group by dtype
    grouper = itertools.groupby(tuples, lambda x: x[2].dtype)

    new_blocks = []
    for dtype, tup_block in grouper:

        values, placement = _stack_arrays(list(tup_block), dtype)

        block = make_block(values, placement=placement)
        new_blocks.append(block)

    return new_blocks
787567
def aggregate_key(self, aggregate_key):
        
        aggregation = self.data_dict[aggregate_key]  # List of dictionaries of numpy arrays/scalars

        # Aggregate sub batch data
        data_dict_keys = {y for x in aggregation for y in x.keys()}

        for key in data_dict_keys:
            # Just average all the statistics from the loss function
            stacked = np.stack([d[key] for d in aggregation], axis=0)
            self.data_dict[key] = np.mean(stacked, axis=0)
474107
def _grouped(iterable, n):
        
        args = [iter(iterable)] * n
        return [[e for e in t if not e is None] for t in zip_longest(*args, fillvalue=None)]
910192
def _task_batcher(tasks, batch_size=None):
    
    from itertools import izip_longest

    if not batch_size:
        batch_size = DEFAULT_TASK_BATCH_SIZE

    # Ensure the batch size is under the task api limit.
    batch_size = min(batch_size, 100)

    args = [iter(tasks)] * batch_size
    return ([task for task in group if task] for group in izip_longest(*args))
247287
def batch(self):
        
        if self._no_kc:
            raise ValueError("Already in a batch")
        self._no_kc = True
        yield
        self._no_kc = False
1038247
def groupby(self, by=None, axis=0, level=None, as_index=True, sort=True,
                group_keys=True, squeeze=False):
        """"""
        from sparklingpandas.groupby import GroupBy
        return GroupBy(self, by=by, axis=axis, level=level, as_index=as_index,
                       sort=sort, group_keys=group_keys, squeeze=squeeze)