[Scipy-tickets] [SciPy] #1165: nanstd, namean etc choke on axis=1.2

SciPy Trac scipy-tickets@scipy....
Fri Apr 23 14:58:19 CDT 2010


#1165: nanstd, namean etc choke on axis=1.2
-------------------------+--------------------------------------------------
 Reporter:  kwgoodman    |       Owner:  somebody
     Type:  defect       |      Status:  new     
 Priority:  normal       |   Milestone:  0.8.0   
Component:  scipy.stats  |     Version:  0.7.0   
 Keywords:               |  
-------------------------+--------------------------------------------------
 Numpy can handle axis=1.2:
 {{{
 >> x = np.random.rand(3,4)

 >> from numpy import std, mean
 >> mean(x, axis=1)
    array([ 0.40414714,  0.38409932,  0.45666896])
 >> mean(x, axis=1.2)
    array([ 0.40414714,  0.38409932,  0.45666896])
 >> std(x, axis=1.2)
    array([ 0.34420113,  0.37077031,  0.33667494])
 }}}

 But scipy.stats can't:
 {{{
 >> from scipy.stats import nanstd, nanmean
 >> nanmean(x, axis=1.2)
 TypeError: tuple indices must be integers, not float
 >> nanstd(x, axis=1.2)
 TypeError: tuple indices must be integers, not float
 }}}

 The crash comes from _chk_asarray. Would changing
 {{{
 outaxis = axis
 }}}
 to
 {{{
 outaxis = int(axis)
 }}}
 in _chk_asarray fix it without causing problems elsewhere?

-- 
Ticket URL: <http://projects.scipy.org/scipy/ticket/1165>
SciPy <http://www.scipy.org>
SciPy is open-source software for mathematics, science, and engineering.


More information about the Scipy-tickets mailing list