[Scipy-svn] r4742 - trunk/scipy/stats

scipy-svn at scipy.org scipy-svn at scipy.org
Fri Sep 26 00:00:47 EDT 2008


Author: cdavid
Date: 2008-09-25 23:00:25 -0500 (Thu, 25 Sep 2008)
New Revision: 4742

Modified:
   trunk/scipy/stats/stats.py
Log:
Deprecate scipy.stats.var for numpy.var.


Modified: trunk/scipy/stats/stats.py
===================================================================
--- trunk/scipy/stats/stats.py	2008-09-24 17:17:51 UTC (rev 4741)
+++ trunk/scipy/stats/stats.py	2008-09-26 04:00:25 UTC (rev 4742)
@@ -1185,13 +1185,18 @@
     sd = samplestd(instack,axis)
     return np.where(sd == 0, 0, m/sd)
 
-
 def var(a, axis=0, bias=False):
     """
 Returns the estimated population variance of the values in the passed
 array (i.e., N-1).  Axis can equal None (ravel array first), or an
 integer (the axis over which to operate).
 """
+    warnings.warn("""\
+scipy.stats.var is deprecated; please update your code to use numpy.var.
+Please note that:
+    - numpy.var axis argument defaults to None, not 0
+    - numpy.var has a ddof argument to replace bias in a more general manner.
+      scipy.stats.var(a, bias=True) can be replaced by scipy.stats.var(x, axis=0, ddof=1).""")
     a, axis = _chk_asarray(a, axis)
     mn = np.expand_dims(mean(a,axis),axis)
     deviations = a - mn




More information about the Scipy-svn mailing list