I have data (features/targets in machine learning terminology), e.g. X1(t), X2(t), ... XN(t) and dependent variable y(t). I can use pandas to plot the kde's of the independent variables (X1(t),...).

I would 1) like to 'get' the pdf's of these kde's. E.g. if it is a lognormal distribution, I get it's parameters (mean, sigma, say) and ideally also 2) that this kde is best fitted as a lognormal or a uniform (although this may be rather obvious in the uniform case).

  1. seems more simple. How do we extract the parameters of a kde in pandas? And is 2? possible?

1 Answer 1


I am not familiar with pandas. However, KDE (kernel density estimation) is a general method for estimating probability densities. The KDE depends on the so-called kernel function and is, essentially, a mixture of such kernel functions with the goal to approximate the density.

For example, using the Guassian kernel, the KDE estimates the density using a mixture of Gaussian. Therefore, requesting the parameters of the KDE does not makes sense as such (at least in the way you want it).

If you have an educated guess that the pde could be well fitted with a lognormal, then you can simply use maximum likelihood to find these parameters. As a control, you can compare the fitted lognormal to the density you obtained from the KDE. Alternatively, you fit the KDE and then approximate it with the lognormal.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.