python 正态分布
作者:互联网
import numpy as np import matplotlib.pyplot as plt import pandas as pd from scipy.stats import norm from scipy.stats import shapiro import statistics data= pd.read_csv('ethercat3.csv',usecols=['Time']) clo_t = data['Time'].tolist() stat, p = shapiro(clo_t) print('stat=%.3f, p=%.3f \n' % (stat, p)) if p > 0.05: print("Data follows Normal Distribution") else: print("Data does not follow Normal Distribution")
[root@centos7 ~]# python3 norm_test.py /usr/local/lib64/python3.6/site-packages/scipy/stats/morestats.py:1681: UserWarning: p-value may not be accurate for N > 5000. warnings.warn("p-value may not be accurate for N > 5000.") stat=0.636, p=0.000 Data does not follow Normal Distribution
import numpy as np import matplotlib.pyplot as plt import pandas as pd from scipy.stats import norm from scipy.stats import shapiro import statistics data= pd.read_csv('ethercat3.csv',usecols=['Time']) clo_t = data['Time'].tolist() stat, p = shapiro(clo_t[0:4000]) print('stat=%.3f, p=%.3f \n' % (stat, p)) if p > 0.05: print("Data follows Normal Distribution") else: print("Data does not follow Normal Distribution")
Normality Test with Python in Data Science
Is my data normal?
标签:stat,stats,Normal,python,print,import,Data,正态分布 来源: https://www.cnblogs.com/dream397/p/15423887.html