TriposG
TriposG

Reputation: 113

Attribute error when calling calling a scipy function

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.

Upvotes: 0

Views: 910

Answers (1)

Jacob Faib
Jacob Faib

Reputation: 1130

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)

Upvotes: 1

Related Questions