I keep running into a problem when using scipy.stats.norm "module has no attribute norm"

Rhines

I have searched through the other posts similar to this one to no avail. I have uninstalled scipy, updated conda, and re-installed scipy. At first I think I had upgraded it with pip accidentally so I removed all that and reinstalled with conda. I am still getting this error. I have done the same think in a google cloud data proc to narrow down whether the error is coming from something about my setup but I am getting the same error. Here is the function I was trying to run:

def get_ci(value, cl, sd):
  loc = scs.stats.norm.ppf(1 - cl/2)
  rng_val = sci.norm.cdf(loc - value/sd)

  lwr_bnd = value - rng_val
  upr_bnd = value + rng_val 

  return_val = (lwr_bnd, upr_bnd)
  return(return_val)

I have tried different import statements too- including:

import scipy
from scipy import stats
import scipy as scs
from scipy import norm
from scipy.stats import norm

Thanks in advance.

Also, if you have any constructive criticism about my post I would appreciate that as well. This is my first post.

Mark Snyder

Well, the function you posted uses the name sci which is not defined in any of your import statements. Try running this in a fresh kernel.

from scipy.stats import norm

def get_ci(value, cl, sd):
  loc = norm.ppf(1 - cl/2)
  rng_val = norm.cdf(loc - value/sd)

  lwr_bnd = value - rng_val
  upr_bnd = value + rng_val 

  return_val = (lwr_bnd, upr_bnd)
  return(return_val)

By the way, you should generally post an exact example of your code so we can run it ourselves. Since your problem is with import statements, it would include the exact import statements combined with the code. Were you actually using all five of those import statements at once and then trying to define your function?

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

Understanding scipy.stats.norm.rvs()?

Scipy.stats norm vs lognorm

scipy.stats.norm for array of values

Scipy.stats allows import of `norm` but not `norm_gen`

Upper bound problem using scipy.stats.rv_continuous

What is probability density function in the context of scipy.stats.norm?

How does SciPy stats.norm.fit determine the parameters

How to restrict plot values for scipy.stats.norm.pdf

scipy.stats.norm density function does not integrate to 1

why the cumsum of pdf and cdf are different for scipy.stats.norm?

scipy.stats.norm for array of values with different accuracy in different method

norm.ppf vs norm.cdf in python's scipy.stats

Why do I get different results when linear regression when using scipy.stats.linregress vs numpy.polyfit(deg=1)

How to get a sigmodal CDF curve use scipy.stats.norm.cdf and matplotlib?

Is there a way to get the error in fitting parameters from scipy.stats.norm.fit?

p_value is 0 when I use scipy.stats.kstest() for large dataset

TypeError: "'numpy.float64' object is not callable" when using scipy.stats.bootstrap

When using a SQL Transaction, how long can I keep it open without causing a problem

How do I get a joint pdf using marginal pdfs in Scipy.stats?

Running into problem when using choose folder in AppleScript

I get a GraphQL error when running this query using the apollo server. Anyone one knows what is the problem with it?

how to keep a python script running when I close putty

I keep on getting pubsepc.yaml error when running flutter

Tensorflow: How to determine the value of clip_norm when using clip_by_norm or clip_by_global_norm?

Java - How to keep timer running when using nextInt()

how to keep server running when using npm run build?

Mochajs test keep running when using async/await

Using batch norm when restore the model?

Matrix dimensions error when using norm()