pyufunc.dict_split_by_chunk#

pyufunc.dict_split_by_chunk(dictionary, chunk_size)#

Split dictionary into a list of chunks.

Parameters:
  • dictionary (dict) – the input dictionary with key-value pairs

  • chunk_size (int) – the size of each chunk

Returns:

a list of the chunk_dict

Return type:

list

See also

split_dict_by_chunk

Examples

>>> import pyufunc as uf
>>> d = {'a': 1, 'b': 2, 'c': 3, 'd': 4}
>>> chunk_size = 2
>>> res = uf.split_dict_by_chunk(d, chunk_size)
>>> res
[{'a': 1, 'b': 2}, {'c': 3, 'd': 4}]