Get distribution name from scipy.stats.distribution object? (SciPy | Python 3)
<p>I'm trying out a bunch of different fits for distributions.  </p>

<p><strong>Is there any way to get the name of the distribution back from the distribution object?</strong>  </p>

<p>I found a way but it doesn't seem very efficient. </p>

<pre><code>distribution = "gamma"
distr = getattr(stats, distribution)
print(distr)
# &lt;scipy.stats._continuous_distns.gamma_gen object at 0x11688f518&gt;
str(distr).split(".")[3].split("_")[0]
# 'gamma'
</code></pre>

<p>You can use the <code>name</code> attribute:</p>

<pre><code>from scipy import stats
print(stats.gamma.name)
</code></pre>

python numpy scipy statistics distribution