我有1000个大数,随机分布在37231到56661之间.
我试图使用stats.gaussian_kde但有些东西不起作用.(也许是因为我对统计学知识不足?)
这是代码:
from scipy import stats.gaussian_kde
import matplotlib.pyplot as plt
# 'data' is a 1D array that contains the initial numbers 37231 to 56661
xmin = min(data)
xmax = max(data)
# get evenly distributed numbers for X axis.
x = linspace(xmin, xmax, 1000) # get 1000 points on x axis
nPoints = len(x)
# get actual kernel density.
density = gaussian_kde(data)
y = density(x)
# print the output data
for i in range(nPoints):
print "%s %s" % …Run Code Online (Sandbox Code Playgroud)