code: def _indices_to_offsets(indices, n):
      offsets = np.insert(np.bincount(indices).cumsum(), 0, 0)
      if len(offsets) != n + 1:
          # last geometries might be empty or missing
          offsets = np.pad(
              offsets,
              (0, n + 1 - len(offsets)),
              "constant",
              constant_values=offsets[-1],
          )
      return offsets
  
file_path: shapely/shapely/_ragged_array.py
imports: import numpy
  from shapely import creation
  from shapely._geometry import GeometryType, get_coordinate_dimension, get_parts, get_rings, get_type_id
  from shapely.coordinates import get_coordinates
  from shapely.predicates import is_empty
label_desc: Use image node_id 2 for calling a global function with example usage: _indices_to_offsets(indices, n) and returns: offsets