Skip to main content
edited tags
Link
juanpa.arrivillaga
  • 94k
  • 13
  • 136
  • 182
Source Link
kstn
  • 581
  • 4
  • 15

strange implicit conversion of data type in numpy

I create a simple numpy of data type uint as below:

import numpy as np
a = np.array([1,2,3], dtype=np.uint)

When I compute

a[0] + 1

I expect a result of 2, but it gives

2.0

Why there is such an implicit conversion to float for np.uint? Note that it does not happen with int or np.int64