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

Support list of quantiles (e.g. 25th and 75th percentiles) #7

Closed
MaxGhenis opened this issue Dec 12, 2019 · 1 comment
Closed

Support list of quantiles (e.g. 25th and 75th percentiles) #7

MaxGhenis opened this issue Dec 12, 2019 · 1 comment

Comments

@MaxGhenis
Copy link

MaxGhenis commented Dec 12, 2019

Just found this package through pandas-dev/pandas#10030, really great stuff. I've put functions for working with weighted data in my microdf package, but looking to remove them in lieu of this and hopefully at some point native pandas support (MaxGhenis/microdf#55).

One feature I've found useful is the ability to pass a list of quantiles to quantile. Currently:

calc.quantile(adults, "income", [0.25, 0.75])

produces:

TypeError: '<' not supported between instances of 'list' and 'int'

This isn't that hard to do outside e.g. with list comprehension so might not be a high priority, but could save some code if it's common:

[calc.quantile(adults, "income", x) for x in [0.25, 0.75]]
@jsvine
Copy link
Owner

jsvine commented Dec 16, 2019

Really glad to hear that you’re finding the library useful, @MaxGhenis. And thanks for noting your use-case here.

For now, I’m going to refrain from adding this feature, because (a) as you note, it’s not terribly difficult to produce the same effect with a list comprehension, and (b) I’m somewhat wary of allowing the library’s parameters to take more than one type. (Maybe one way would be to create a new method, calc.quantiles, plural, that could accept a list?)

But I can totally see the argument for adding it, and I’m open to being persuaded to do so in the future.

@jsvine jsvine closed this as completed Dec 16, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants