# -*- coding: utf-8 -*-
"""
Created on Wed Jun 19 14:59:32 2019
@author: User
"""
# 《Python数据分析基础》中国统计出版社
#import numpy as np
from scipy import stats
import pandas as pd
import statsmodels.api as sm
moisture=pd.read_csv(u'data\\ch6\moisture.csv',encoding = "gbk")
print(moisture.head())
'''
alternative:备择假设符号
下面运行结果,第一个值为根据样本数据计算的Z统计量,第二个值为该统计量对应的P值
'''
print(sm.stats.DescrStatsW(moisture['moisture']).ztest_mean(value=4,
alternative='larger'))
运行:
(-0.440385831166995, 0.6701711574008213)