Table of Contents

Class DTypePromotionError

Namespace
NumSharp
Assembly
NumSharp.dll

numpy.exceptions.DTypePromotionError — raised when two (or more) DTypes have no common DType, i.e. np.promote_types / np.result_type cannot find a dtype that can hold every input (NEP 42's common_dtype protocol returned NotImplemented in both directions).

public class DTypePromotionError : TypeError, ISerializable, INumSharpException
Inheritance
DTypePromotionError
Implements
Inherited Members

Remarks

Derives from TypeError exactly as NumPy's does (DTypePromotionError(TypeError)), so a catch (TypeError) written for NumPy 1.x code keeps working. The two message shapes are NumPy's verbatim texts from common_dtype.c:

  • The DTypes <class 'numpy.dtypes.DateTime64DType'> and <class 'numpy.dtypes.Float64DType'> do not have a common DType. For example they cannot be stored in a single array unless the dtype is `object`. (the pairwise PyArray_CommonDType)
  • The DType %S could not be promoted by %S. This means that no common DType exists for the given inputs. For example they cannot be stored in a single array unless the dtype is `object`. The full list of DTypes is: (%S, …) (the sequence reduction PyArray_PromoteDTypeSequence)

Constructors

DTypePromotionError()

public DTypePromotionError()

DTypePromotionError(string)

public DTypePromotionError(string message)

Parameters

message string

DTypePromotionError(string, Exception)

public DTypePromotionError(string message, Exception innerException)

Parameters

message string
innerException Exception