Attribute error when calling calling a scipy function

675 Views Asked by At

I am trying to run the following function defined on a separate python file using jupyter notebook

def f(x):
    return 2 * norm.cdf(x)

AttributeError: 'function' object has no attribute 'cdf'

However, I am getting an Attribute error. I am not sure what is exactly going on as I imported the module correctly in the .py file.

1

There are 1 best solutions below

0
Jacob Faib On

There are plenty of norm()s in the sea, so your problem is very likely that you are not calling the norm() that you think you are. It is always good to be verbose :)

import scipy as scp
from scipy import stats

def f(x):
    return 2*scp.stats.norm.cdf(x)