I try to use elements from a numpy array as input for a module Fraction, and I get the following error: "TypeError: both arguments must be Rational instances"
For example, if:
Y = np.array([7,1], dtype='int64')
X = Y[0]*3+Y[1]
And then:
a = Fraction(58,X)
I get the same error. I also tried to do with X=X.astype('int')or X=X.astype('int32')without success.
What do I need to do to convert the numpy array to the "Rational instance" that is needed for the Fraction module?
source
share