Skip to content
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

ERR/DEPR: Fix quantile error message / remove percentile_width #10881

Merged
merged 1 commit into from
Aug 23, 2015

Conversation

sinhrks
Copy link
Member

@sinhrks sinhrks commented Aug 21, 2015

Currently, error is raised from numpy and incorrect for pandas

s = pd.Series([1, 2, 3])
s.quantile(2)
#   File ".../numpy/lib/function_base.py", line 3078, in _percentile
#     raise ValueError("Percentiles must be in the range [0,100]")
# ValueError: Percentiles must be in the range [0,100]

describe using percentiles option outputs better error message, but not check lower limit.

# OK
s.describe(percentiles=[2])
# Traceback (most recent call last):
#   File "pandas/core/generic.py", line 4167, in describe
#    raise ValueError(msg.format(list(percentiles)))
# ValueError: percentiles should all be in the interval [0, 1]. Try [0.02] instead.

# NG
s.describe(percentiles=[-2])
#   File ".../numpy/lib/function_base.py", line 3078, in _percentile
#     raise ValueError("Percentiles must be in the range [0,100]")
# ValueError: Percentiles must be in the range [0,100]

This PR fix both error messages. Also, remove deprecated percentile_width option in describe.

@sinhrks sinhrks added Error Reporting Incorrect or improved errors from pandas Deprecate Functionality to remove in pandas labels Aug 21, 2015
@sinhrks sinhrks added this to the 0.17.0 milestone Aug 21, 2015
@sinhrks sinhrks force-pushed the quantiles branch 2 times, most recently from f2f5e00 to 7fc1843 Compare August 22, 2015 01:13
@sinhrks
Copy link
Member Author

sinhrks commented Aug 22, 2015

Ah, found an existing bug which drops Series.name. Fixed in the same PR.

# current master
pd.Series([1, 2, 3], name='x').quantile([0.5])
# 0.5    2
# dtype: float64

jreback added a commit that referenced this pull request Aug 23, 2015
ERR/DEPR: Fix quantile error message / remove percentile_width
@jreback jreback merged commit 0ff3a5d into pandas-dev:master Aug 23, 2015
@jreback
Copy link
Contributor

jreback commented Aug 23, 2015

thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Deprecate Functionality to remove in pandas Error Reporting Incorrect or improved errors from pandas
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants