[Numpy-discussion] floats as axis
josef.pktd at gmail.com
josef.pktd at gmail.com
Sun Apr 25 09:16:49 EDT 2010
(some) numpy functions take floats as valid axis argument. Is this a feature?
>>> np.ones((2,3)).sum(1.2)
array([ 3., 3.])
>>> np.ones((2,3)).sum(1.99)
array([ 3., 3.])
>>> np.mean((1.5,0.5))
1.0
>>> np.mean(1.5,0.5)
1.5
Keith pointed out that scipy.stats.nanmean has a different behavior
>>> stats.nanmean(np.ones((2,3)), axis= 1.2)
Traceback (most recent call last):
<...>
TypeError: tuple indices must be integers
see: http://projects.scipy.org/scipy/ticket/1165
What's the preferred behavior?
Josef
More information about the NumPy-Discussion
mailing list