This seems to be one of the unfortunate artifacts of the way Numpy integers interact with Python's abstract classes (and it's also dependent on whether you run a 32-bit or 64-bit Python, because dtype='int'
means either np.int32
or np.int64
, but never Python int
).
Explicitly converting to Python int
should work:
Fraction(58, int(X))