Skip to content

Series.rolling(3).quantile(10) segmentation fault #15463

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

Closed
kernc opened this issue Feb 20, 2017 · 3 comments
Closed

Series.rolling(3).quantile(10) segmentation fault #15463

kernc opened this issue Feb 20, 2017 · 3 comments
Labels
Bug Numeric Operations Arithmetic, Comparison, and Logical operations Reshaping Concat, Merge/Join, Stack/Unstack, Explode
Milestone

Comments

@kernc
Copy link
Contributor

kernc commented Feb 20, 2017

Code Sample, a copy-pastable example if possible

>>> pd.Series(np.arange(10)).rolling(3).quantile(10)
[1]    20214 segmentation fault

Problem description

The value 10 is over the fraction of 1 which .quantile() works with, but I guess it still shouldn't crash my interpreter.

Expected Output

ValueError: quantile value 10 not in [0, 1]

Output of pd.show_versions()

pandas 0.19.0+479.g4842bc7

@jreback
Copy link
Contributor

jreback commented Feb 21, 2017

yep, not very friendly...PR's appreciated!

@jreback jreback added Bug Difficulty Novice Numeric Operations Arithmetic, Comparison, and Logical operations Reshaping Concat, Merge/Join, Stack/Unstack, Explode labels Feb 21, 2017
@jreback jreback added this to the Next Major Release milestone Feb 21, 2017
@csizsek
Copy link
Contributor

csizsek commented Feb 22, 2017

Hi @kernc and @jreback , I'm thinking about fixing this issue. Any idea where to start? (I have read the contribution documentation, set up the environment and was able to reproduce.)

@jreback
Copy link
Contributor

jreback commented Feb 22, 2017

you can add a validation right here 0 <= quantile <= 1: https://github.com/pandas-dev/pandas/blob/master/pandas/window.pyx#L1288, and raise a ValueError if not in range. please add some tests as well.

thanks!

@jreback jreback modified the milestones: 0.20.0, Next Major Release Feb 22, 2017
AnkurDedania pushed a commit to AnkurDedania/pandas that referenced this issue Mar 21, 2017
…using a segfault when quantile is out of range

closes pandas-dev#15463

Author: Peter Csizsek <[email protected]>

Closes pandas-dev#15476 from csizsek/fix-rolling-quantile-segfault and squashes the following commits:

e31e5be [Peter Csizsek] Correctly catching exception in the test for Rolling.quantile.
4eea34a [Peter Csizsek] Refactored and moved exception throwing test to a new function for Rolling.quantile().
8b1e020 [Peter Csizsek] Added a note about the Rolling.quantile bug fix to the changelog.
f39b122 [Peter Csizsek] Added a new test case to roll_quantile_test to trigger a TypeError when called with a string.
f736ca2 [Peter Csizsek] The roll_quantile function in window.pyx now raises a ValueError when the quantile value is not in [0.0, 1.0]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Numeric Operations Arithmetic, Comparison, and Logical operations Reshaping Concat, Merge/Join, Stack/Unstack, Explode
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants