Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Error on Importing module numpy.math

Tags:

python

numpy

when I use

from numpy.math import factorial as fact 

I get : ImportError: No module named 'numpy.math'

but

import numpy
fact=numpy.math.factorial

works.

Why ? Is numpy.math really implemented like other modules ?

like image 712
Top Maths Avatar asked Oct 21 '25 04:10

Top Maths


1 Answers

numpy seems to import the standard math library:

In [8]: import numpy

In [9]: import math

In [10]: math is numpy.math
Out[10]: True

So it is not the submodule of numpy, just an imported module object. That is why you can not import like this: from numpy.math import something .

like image 159


Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!