completed functionality, but flask interface needs to be done
@45a2bb502c715fef30ce04f0d53d71b88da12bab
+++ tools/algo/ANOVA.py
... | ... | @@ -0,0 +1,34 @@ |
1 | +import numpy as np | |
2 | +import pandas as pd | |
3 | +from statsmodels.stats.anova import anova_lm | |
4 | +from statsmodels.formula.api import ols | |
5 | +from scipy.stats import stats | |
6 | +from tools.algo.humidity import absolute_humidity | |
7 | +from tools.algo.interpolation import interpolate_value | |
8 | +from datetime import datetime | |
9 | + | |
10 | +if __name__ == "__main__": | |
11 | + df_weather = pd.read_csv("/home/juni/PycharmProjects/failure_analysis/data/weather/202007010000_202308310000_f.csv") | |
12 | + df_failure = pd.read_excel("/home/juni/PycharmProjects/failure_analysis/data/failure/대옹 작업내용.xlsx") | |
13 | + times = df_failure["작업 시작 시간"] | |
14 | + temp = [] | |
15 | + humidity = [] | |
16 | + | |
17 | + for time in times: | |
18 | + temp.append(interpolate_value(df_weather, timestamp=time, col_key="기온", k=6)) | |
19 | + humidity.append(interpolate_value(df_weather, timestamp=time, col_key="상대습도", k=6)) | |
20 | + | |
21 | + absolute_humidity = absolute_humidity(humidity, temp) | |
22 | + | |
23 | + df_failure["기온"] = temp | |
24 | + df_failure["상대습도"] = humidity | |
25 | + df_failure["절대습도"] = absolute_humidity | |
26 | + df_failure['불량 여부'] = np.where(df_failure['불량 여부'] == 'F', 0, df_failure['불량 여부']) | |
27 | + df_failure['불량 여부'] = np.where(df_failure['불량 여부'] == 'T', 1, df_failure['불량 여부']) | |
28 | + | |
29 | + df_failure = df_failure.loc[:,['불량 여부', '상대습도', '기온', '절대습도']] | |
30 | + | |
31 | + F_statistic, pVal = stats.f_oneway(df_failure[df_failure["불량 여부"] == 0].loc[:,['상대습도', '기온', '절대습도']], | |
32 | + df_failure[df_failure["불량 여부"] == 1].loc[:,['상대습도', '기온', '절대습도']]) | |
33 | + | |
34 | + print(F_statistic, pVal)(파일 끝에 줄바꿈 문자 없음) |
--- tools/algo/correlation.py
+++ tools/algo/correlation.py
... | ... | @@ -26,7 +26,6 @@ |
26 | 26 |
df_failure['불량 여부'] = np.where(df_failure['불량 여부'] == 'F', 0, df_failure['불량 여부']) |
27 | 27 |
df_failure['불량 여부'] = np.where(df_failure['불량 여부'] == 'T', 1, df_failure['불량 여부']) |
28 | 28 |
|
29 |
- |
|
30 | 29 |
df = df_failure.copy() |
31 | 30 |
correlation_manufacturing_abhumidity = pointbiserialr(df["절대습도"], df["불량 여부"]) |
32 | 31 |
correlation_manufacturing_rehumidity = pointbiserialr(df["상대습도"], df["불량 여부"]) |
Add a comment
Delete comment
Once you delete this comment, you won't be able to recover it. Are you sure you want to delete this comment?