This may well be completely trivial.
I want to call the spearmanr function from scipy: (the data are just examples)
import scipy from numpy import * Len = [2,3,5,7,2] Pop = [5,2,6,3,2] a = array(Len) b = array(Pop) print scipy.stats.spearmanr(a,b)
This generates the error:
AttributeError: 'module' object has no attribute 'spearmanr'
What am I doing wrong?
Thanks
In the above program, first, we need to import the norm module from the scipy. stats, then we passed the data as Numpy array in the cdf() function. To get the median of the distribution, we can use the Percent Point Function (PPF), this is the inverse of the CDF.
stats ) This module contains a large number of probability distributions, summary and frequency statistics, correlation functions and statistical tests, masked statistics, kernel density estimation, quasi-Monte Carlo functionality, and more.
A cumulative distribution function (CDF) tells us the probability that a random variable takes on a value less than or equal to some value. This tutorial explains how to calculate and plot values for the normal CDF in Python.
Use import scipy.stats
. Then it works. Importing a package does not automatically import all the subpackages/modules. In these cases you have to do this explicitly.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With