Saturday, March 28, 2020

percentiles and moments in datascience using python

import numpy as np
import matplotlib.pyplot as plt

vals=np.random.normal(0,0.5,10000)

plt.hist(vals,50)
plt.show()

output:


np.percentile(vals,50)
-0.0006091649949392949
np.percentile(vals,90)
0.6333622008770741

Movements:
import numpy as np
import matplotlib.pyplot as plt

vals=np.random.normal(0,0.5,10000)

plt.hist(vals,50)
plt.show()

output:
np.mean(vals)
0.002411873839262703

np.var(vals)
0.25225058001660977

import scipy.stats as sp
sp.skew(vals)
0.016161251790655015

sp.kurtosis(vals)
-0.034877789070170806


No comments:

Post a Comment

python class topic video