-1

I am using matplotlib in my Python code. I got following warning:
xxx.py:88: MatplotlibDeprecationWarning: scipy.stats.norm.pdf y = 100 * mlab.normpdf(bin_middles, mu, sigma)*bin_width
I was wondering what the issue is, so I can solve it and avoid warnings.

Shannon
  • 985
  • 3
  • 11
  • 25

1 Answers1

6

The documentation tells us about matplotlib.mlab.normpdf

Deprecated since version 2.2: scipy.stats.norm.pdf

This translates into: Do not use this function any more, use scipy.stats.norm.pdf instead.

Hence a previous code like

import matplotlib.mlab as mlab
import numpy as np

x = np.linspace(-3,3)
mu = 0
sigma = 1
y = mlab.normpdf(x, mu, sigma)

should now read

import numpy as np
import scipy.stats

x = np.linspace(-3,3)
mu = 0
sigma = 1
y = scipy.stats.norm.pdf(x, mu, sigma)
ImportanceOfBeingErnest
  • 321,279
  • 53
  • 665
  • 712