title: Retrieve values from Scipy gaussian_kde
body: <p>It's the first time I'm using Scipy because I couldn't find many libraries that could generate KDE data directly without plotting beforehand like what <em>Pandas</em> does (data.plot(kind='kde').
  I'm trying to get the data in the KDE as a list or array but it's referring to the scipy object <strong>&lt;scipy.stats.kde.gaussian_kde object at 0x000002C4A8D077F0&gt;</strong></p>
  <p>Is there a np.array(density) <em>(Numpy)</em> or density.values <em>(Pandas)</em> similar function that could retrieve the values ?</p>
  <pre><code>import matplotlib.pyplot as plt
  import numpy as np
  import scipy.stats as stats
  
  data = [992.9832, 846.1371, 994.2491, ..., 0.0]
  
  # generate histogram data
  h, e = np.histogram(data, bins='auto')
  width = 1 * (e[1] - e[0])
  center = (e[:-1] + e[1:]) / 2
  print(np.array(data).mean())
  x = np.linspace(e.min(), e.max())
  
  # plot the histogram
  plt.figure(figsize=(8,6))
  plt.bar(center, h, align='center', width=width, label='histogram')
  plt.axvline(np.array(data).mean(), color='k', linestyle='dashed', linewidth=1)
  plt.legend()
  plt.show()
  
  # Plot KDE
  density = stats.gaussian_kde(data)
  print('DENSITY TYPE:', type(density))
  print('DENSITY:', density)
  plt.plot(center, density(center))
  </code></pre>
  <p><a href="https://i.stack.imgur.com/DcjMz.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/DcjMz.png" alt="enter image description here" /></a></p>