title: Calculating KDE from weighted data using scipy
body: <p>I want to calculate (not just plot) a KDE of weighted data using SciPy.
  However, despite what I found at <a href="https://docs.scipy.org/doc/scipy/reference/generated/scipy.stats.gaussian_kde.html" rel="nofollow noreferrer">the official documentation</a>, I cannot seem to pass all three arguments to the function.</p>
  
  <p>E.g. this bit of code:</p>
  
  <pre><code>from scipy import stats
  
  values = np.random.lognormal(size=1000)
  weights = np.random.choice([1.0,10.0,100.0], size=len(values))
  
  kde_pdf = stats.gaussian_kde(np.log10(values), 'scott', weights)
  </code></pre>
  
  <p>results in the error <code>TypeError: __init__() takes at most 3 arguments (4 given)</code></p>
  
  <p>I have tried other permutations of keyworded and non-keyworded arguments, but nothing seems to work. How can I get the KDE pdf from my weighted data?</p>