Object arrays are ndarrays with a datatype of np.object
whose elements are Python objects, enabling use of numpy's vectorized operations and broadcasting rules with arbitrary Python types. Object arrays have certain special rules to resolve ambiguities that arise between python types and numpy types, described here.
Envisioned uses of object arrays include:
- Creating ndarrays whose elements are other ndarrays of varying length
- Creating ndarrays containing number-like Python objects, for example mpmath's multiprecision types, or Python's built-in arbitrary precision integers or Decimal type.