dimanche 29 mai 2016

How to get the distribution name from a spicy.stats. frozen distribution?

Access to a Frozen Distribution's Name

When creating a frozen distribution from the scipy.stats package, how can the distribution's name be accessed once the distribution instance is frozen? Trying to access the .name attribute produces an error since it is no longer an attribute of the rv variable.

import scipy.stats as stats

# Get the name of the distribution
print 'gamma :', stats.norm.name

# Create frozen distribution
rv = stats.norm()

# Get the name of the frozen distribution
print 'rv    :', rv.name


gamma : norm
rv    :

 ---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
      9 
     10 # Get the name of the frozen distribution
---> 11 print 'rv    :', rv.name

 AttributeError: 'rv_frozen' object has no attribute 'name'




Aucun commentaire:

Enregistrer un commentaire