INNER CODE UNIT · Python
expand
open2c/bioframe · src/bioframe/ops.py:150
def expand(df, pad=None, scale=None, side="both", cols=None):
"""
Expand each interval by an amount specified with `pad`.
Negative values for pad shrink the interval, up to the midpoint.
Multiplicative rescaling of intervals enabled with scale. Only one of pad
or scale can be provided. Often followed by :func:`trim()`.
Parameters
----------
df : pandas.DataFrame
pad : int, optional
The amount by which the intervals are additively expanded *on each side*.
Negative values for pad shrink intervals, but not beyond the interval
midpoint. Either `pad` or `scale` must be supplied.
scale : float, optional