[Scipy-tickets] [SciPy] #1634: scoreateprecentile return the worng value when used on pandas.Series
SciPy Trac
scipy-tickets@scipy....
Tue Mar 27 09:57:06 CDT 2012
#1634: scoreateprecentile return the worng value when used on pandas.Series
----------------------------------------+-----------------------------------
Reporter: imrisofer | Owner: somebody
Type: defect | Status: new
Priority: normal | Milestone: Unscheduled
Component: scipy.stats | Version: 0.10.0
Keywords: scoreateprecentile, pandas |
----------------------------------------+-----------------------------------
Comment(by josefpktd):
I'm not sure what the answer is.
My impression: it's a Pandas or user problem
It looks like the function is written for np.asanyarray and not for
asarray. It returns the same array subclass as the input for matrix and
masked arrays.
(I never checked this function in detail, and I just saw that limit
doesn't work with 2d arrays.)
As basic policy we need to be able to assume something about array
subclasses. For example when I rewrote stats.zscore, I used np.asanyarray
and made sure it works for matrices and masked arrays. I would think that
we can assume that basic algebraic operations and indexing/slicing works
in the same way as for numpy arrays. (besides matrix multiplication.
as aside
stats.zscore returns different values if it is called with an ndarray or
with a pandas series (because of different default ddof)
{{{
>>> stats.zscore(a).std()
1.0
>>> stats.zscore(b).std()
1.0
>>> type(stats.zscore(b))
<class 'pandas.core.series.Series'>
>>> np.std(np.asarray(stats.zscore(b)))
0.99498743710661997
}}}
--
Ticket URL: <http://projects.scipy.org/scipy/ticket/1634#comment:1>
SciPy <http://www.scipy.org>
SciPy is open-source software for mathematics, science, and engineering.
More information about the Scipy-tickets
mailing list