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?

上一篇:两块Arduino—ble板子的蓝牙连接教程


下一篇:实验7:基于REST API的SDN北向应用实践