[NumPy-Tickets] [NumPy] #1710: output dtype of mean, median, var/std should not depend on axis argument

NumPy Trac numpy-tickets@scipy....
Wed Jan 12 09:40:45 CST 2011


#1710: output dtype of mean, median, var/std should not depend on axis argument
------------------------+---------------------------------------------------
 Reporter:  bsouthey    |       Owner:  somebody
     Type:  defect      |      Status:  new     
 Priority:  normal      |   Milestone:  2.0.0   
Component:  numpy.core  |     Version:  1.5.0   
 Keywords:              |  
------------------------+---------------------------------------------------
 Keith Goodman reported that axis argument determines the output dtype of
 mean, median, var/std [http://mail.scipy.org/pipermail/numpy-
 discussion/2010-December/054253.html]

 There should be the expectation the output should be the same regardless
 of the axis argument. For example, for these floating point and integer
 examples the output dtype should either be float32 or float64:
 {{{
 >>> np.array([[1, 2], [3, 4]], dtype=np.float32).mean(axis=0).dtype
 dtype('float32')
 >>> np.array([[1, 2], [3, 4]], dtype=np.float32).mean(axis=None).dtype
 dtype('float64')

 >>> np.array([[1, 2], [3, 4]], dtype=np.int8).mean(axis=None,
 dtype=np.float32).dtype
 dtype('float64')
 >>> np.array([[1, 2], [3, 4]], dtype=np.int8).mean(axis=1,
 dtype=np.float32).dtype
 dtype('float32')
 }}}

-- 
Ticket URL: <http://projects.scipy.org/numpy/ticket/1710>
NumPy <http://projects.scipy.org/numpy>
My example project


More information about the NumPy-Tickets mailing list