Him
Him

Reputation: 5551

scipy stats distributions documentation

I'm trying to track down the docs for the various distributions in scipy.stats. It is easy enough to google around for them, but I like to use the built-in help function for kicks sometimes. Through a series of help calls, can find that scipy has a stats module and that scipy.stats has a binom distribution. However, at that point, using help becomes tricky. help(scipy.stats.binom) actually returns a help document for a class named binom_gen which inherits methods from some parent abstract class whose __init__ method is utterly uninformative. However, it does provide the following hint: "See help(type(self)) for accurate signature." Okay. Since I do not have access to self from outside of the class code itself, I assume that this means "go ahead and instantiate an object, and then call help." After some trial and error on getting literally any old parameters to not raise an Exception (specifically, scipy.stats.binom(0.5,0.5) returns successfully), we can call help on that thing.

Both help(scipy.stats.binom(0.5,0.5)) and help(type(scipy.stats.binom(0.5,0.5)) give the docs for class rv_frozen, which is equally uninformative, and actually gives the same suggestion to: "See help(type(self)) for accurate signature."

How do I access the help for distributions in scipy.stats? More generally, is there a meaningful way to navigate an abstract class morass via successive calls to the help function, or must I simply know a priori the class ultimately returned by these factories?

Upvotes: 0

Views: 151

Answers (1)

Ethan Mills
Ethan Mills

Reputation: 11

If you use ipython then I believe scipy.stats.binom? achieves this.

Upvotes: 1

Related Questions