# dask.bag.Bag.repartition

#### Bag.repartition(npartitions=None, partition_size=None)

Repartition Bag across new divisions.

* **Parameters:**
  **npartitions**
  : Number of partitions of output.

  **partition_size**
  : Max number of bytes of memory for each partition. Use numbers or
    strings like 5MB.
    <br/>
    #### WARNING
    This keyword argument triggers computation to determine
    the memory size of each partition, which may be expensive.

### Notes

Exactly one of `npartitions` or `partition_size` should be specified.
A `ValueError` will be raised when that is not the case.

### Examples

```pycon
>>> b.repartition(5)  # set to have 5 partitions
```

<!-- !! processed by numpydoc !! -->
