귀무가설 : 기존의 주장
대립가설 : 내가 주장하고자 하는 바
p-value : 귀무가설을 지지하는 확률
from scipy import stats
stats.ttest_1samp(data, 가설검정 하고자하는 mean)
stats.ttest_ind()
var_equal = True(Student's test)
var_equal = False(Welch's test)
stats.ttest_rel()
stats.ttest_ind(data1, data2, alternative='greater')
#two-side, less도 사용가능stats.f_oneway(g1, g2, g3)
p = [0.1, 0, 0.3, 0.6, 0]
np.random.choice(5, 3, p=p, replace=True) #복원추출, p를 지정하지않는다면 같은 확률로 무작위 샘플링
df2[df2['자치구'].isin(sample_area)]['이팝나무']
#sample_area안에 있는 자치구들의 row를 불러와서 '이팝나무'column을 호출
df = df.replace('[^\d.]', '',regex=True).astype(float)
df.applymap(lambda x: re.sub(r'[^\d.]+', '', x)).astype(float)
df.transform(lambda x: x.str.replace(r'[^\d.]+', '')).astype(float)
tree1 = pd.to_numeric(trees['은행나무'].str.replace(',','')) # 은행나무 데이터
-> df.apply(replace()) replace는 잘 적용됨
-> df.applylambda x: re.sub(r'[^\d.]+', '', x)).astype(float)
가 적용되지 않는 이유에 대해서 의문이 생김
Pandas에서 제공하지 않는 기능, 즉 내가 만든 커스텀 함수(custom function)를 DataFrame에 적용하려면 map함수, apply함수, applymap함수를 사용
replace는 데이터프레임 차원에서도 적용가능
re.sub() : 문자열에만 적용
anova
다양한 sampling