Skip to content

ENH: subclass Series to represent PMF and CDF #17577

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
AllenDowney opened this issue Sep 18, 2017 · 4 comments
Closed

ENH: subclass Series to represent PMF and CDF #17577

AllenDowney opened this issue Sep 18, 2017 · 4 comments

Comments

@AllenDowney
Copy link
Contributor

AllenDowney commented Sep 18, 2017

For my own purposes, I am considering writing classes to represent PMFs and CDFs using Pandas Series as the implementation, and an API similar to what I did in the thinkstats2 library (but made more stylistically consistent with Pandas).

Has there been any discussion of adding something like this to Pandas? If I develop it, would you be interested in seeing a proposal to include it? (I ask now because it might influence some design decisions if I am targeting inclusion in Pandas).

@TomAugspurger
Copy link
Contributor

I suspect it would be out of scope for pandas, since it's pretty stats-specific.

(aside: statsmodels has an empirical CDF implementation at http://www.statsmodels.org/dev/generated/statsmodels.distributions.empirical_distribution.ECDF.html. Not sure if that suites your needs or not).

@AllenDowney
Copy link
Contributor Author

Thanks for the quick reply, Tom. Understood.

The ECDF in StatsModels is along the lines of what I have in mind, but there are a few more methods I'd like to provide (like random sampling).

@chris-b1
Copy link
Contributor

see #14781, idea from xarray here - this feels like a usecase that might be well suited to that accessor idea instead of subclassing. Idea would be to be able to write something like

@pd.register_series_accessor('stat')
class StatAccessor:
    def custom_function1(...)
        pass


s = pd.Series([1,2,3,4])

s.stat.custom_function1(...)

I do agree with @TomAugspurger that this is probably out of scope for pandas to be built in

@jreback
Copy link
Contributor

jreback commented Sep 20, 2017

closing. as indicated this is out-of-scope. We have removed all non-basic stats functionaility recently. This should be done in statsmodels or a pandas plug-in package (just came up with that!)

@jreback jreback closed this as completed Sep 20, 2017
@jreback jreback added the Stats label Sep 20, 2017
@jreback jreback added this to the No action milestone Sep 20, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants