-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
ENH: Quantiles accepts an array #6955
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
@@ -482,6 +482,8 @@ Enhancements | |||
- Added ``how`` option to rolling-moment functions to dictate how to handle resampling; :func:``rolling_max`` defaults to max, | |||
:func:``rolling_min`` defaults to min, and all others default to mean (:issue:`6297`) | |||
- ``CustomBuisnessMonthBegin`` and ``CustomBusinessMonthEnd`` are now available (:issue:`6866`) | |||
- :meth:`Series.quantile` and :meth:`DataFrame.quantile` now accept an array of | |||
quantiles. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i think the last line has to be indented
q : quantile, default 0.5 (50% quantile) | ||
0 <= q <= 1 | ||
q : float or array-like, default 0.5 (50% quantile) | ||
0 <= q <= 1, the quantile to compute |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe quantile
-> quantile(s)
?
Thanks, updated. |
@@ -10945,6 +10945,16 @@ def test_quantile(self): | |||
xp = df.median() | |||
assert_series_equal(rs, xp) | |||
|
|||
def test_quantile_multi(self): | |||
df = DataFrame(np.arange(1, 11).repeat(2).reshape(10, 2), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe test with an empty frame too
Added a test on empty frames Also fixed a bug, I wasn't passing the axis argument correctly when quantiles was an array. |
One more thing, thinking ahead to fixing #4196; Are we ok with returning a |
for |
OK. Good to merge? |
can you add a test with datetimes both for Series and Frame for completeness? |
Do you mean with a DatetimeIndex or Datetime values? It doesn't look like we support quantile on this is off master: In [15]: df
Out[15]:
a b
0 2010-01-01 1
1 2011-01-01 2
2 2012-01-01 3
[3 rows x 2 columns]
In [16]: df.quantile(.5)
Out[16]:
b 2
dtype: float64
In [17]: df.set_index('a').quantile(.5)
Out[17]:
b 2
dtype: float64 |
have to pass I think it will blow up actually |
iin docstring can you change ref from scipy.score..... to np.percentile (as tht is what it uses now) |
update docs
yeah it blows up pretty badly. My simple fix didn't work. Separate issue? |
sure |
ENH: Quantiles accepts an array
OK. I'll make an issue for that. This PR doesn't officially close any. |
Doesn't quite finish #4196, but it should be easy not that
quantile
takes arrays.I did this on top of #6953, so that should go in first.