### Navigation

- index
- modules |
- modules |
- next |
- previous |
- NumPy v1.7 Manual (DRAFT) »
- NumPy Reference »
- Routines »
- Data type routines »

# numpy.promote_types

`numpy.``promote_types`(type1, type2)

  Returns the data type with the smallest size and smallest scalar kind to which both `type1` and `type2` may be safely cast. The returned data type is always in native byte order.

  This function is symmetric and associative.

  Parameters : | type1 : dtype or dtype specifier First data type. type2 : dtype or dtype specifier Second data type.
  Returns : | out : dtype The promoted data type.

  See also

  `result_type`, `dtype`, `can_cast`

  Notes

  New in version 1.6.0.

  Examples

      >>> np.promote_types('f4', 'f8')
      dtype('float64')

      >>> np.promote_types('i8', 'f4')
      dtype('float64')

      >>> np.promote_types('>i8', '<c8')
      dtype('complex128')

      >>> np.promote_types('i1', 'S8')
      Traceback (most recent call last):
        File "<stdin>", line 1, in <module>
      TypeError: invalid type promotion

### Navigation

- index
- modules |
- modules |
- next |
- previous |
- NumPy v1.7 Manual (DRAFT) »
- NumPy Reference »
- Routines »
- Data type routines »