<jupyter_start><jupyter_text><jupyter_code>import pandas as pd
import joblib
import numpy as np
import matplotlib.pyplot as plt<jupyter_output><empty_output><jupyter_text>load<jupyter_code>from google.colab import drive
drive.mount('/content/drive')
root = '/content/drive/MyDrive/台塑輕油案子/data/c620/cleaned/'

icg_df = pd.read_csv(root+'icg_train.csv',index_col=0)

t651_df = pd.read_csv(root+'t651_train.csv',index_col=0).dropna(axis=0)
idx = t651_df.index

c620_df = pd.read_csv(root+'c620_train.csv',index_col=0).loc[idx]
c620_mb = pd.read_csv(root+'c620_mbcheck.csv',index_col=0).loc[idx]

c660_df = pd.read_csv(root+'c660_train.csv',index_col=0).loc[idx]
c660_mb = pd.read_csv(root+'c660_mbcheck.csv',index_col=0).loc[idx]

c670_df = pd.read_csv(root+'c670_train.csv',index_col=0).loc[idx]
c670_mb = pd.read_csv(root+'c670_mbcheck.csv',index_col=0).loc[idx]
root = '/content/drive/MyDrive/台塑輕油案子/data/c620/col_names/'
icg_col = joblib.load(root+'icg_col_names.pkl')
c620_col = joblib.load(root+'c620_col_names.pkl')
c660_col = joblib.load(root+'c660_col_names.pkl')
c670_col = joblib.load(root+'c670_col_names.pkl')
t651_col = joblib.load(root+'t651_col_names.pkl')<jupyter_output><empty_output><jupyter_text>check c620&t651 -> c660<jupyter_code>t651_mf = t651_df[t651_col['MFR']]
c620_mf = c620_mb.iloc[:,[3]]
total = t651_mf.values + c620_mf.values
t651_mf = t651_mf/total
c620_mf = c620_mf/total
t651_x41 = t651_df[t651_col['x41']]
c620_w3 = c620_df[c620_col['sidedraw_x']]
c660_feed_pred = c620_w3.values*c620_mf.values + t651_x41.values*t651_mf.values
c660_feed_pred = pd.DataFrame(c660_feed_pred,index=idx,columns=c660_col['x41'])
c660_feed_pred.head(3)
c660_feed = c660_df[c660_col['x41']]
c660_feed.head(3)
np.allclose(c660_feed.values,c660_feed_pred.values)<jupyter_output><empty_output><jupyter_text>check c620,c660 -> c670<jupyter_code>c660_w4 = c660_df[c660_col['bottoms_x']]
c620_w4 = c620_df[c620_col['bottoms_x']]
Tray_43_mfr = c670_mb.loc[:,['Toluene Column C670 Operation_Feed Properties \n@ Tray 43_Mass Flow Rate_ton/hr']]
Tray_54_mfr = c670_mb.loc[:,['Toluene Column C670 Operation_Feed Properties \n@ Tray 54_Mass Flow Rate_ton/hr']]
total = Tray_43_mfr.values + Tray_54_mfr.values
Tray_43_mfr = Tray_43_mfr/total
Tray_54_mfr = Tray_54_mfr/total
combined_pred = c660_w4.values*Tray_43_mfr.values + c620_w4.values*Tray_54_mfr.values
combined_pred = pd.DataFrame(combined_pred,index=idx,columns=c670_col['combined'])
combined_pred.head(3)
combined = c670_df[c670_col['combined']]
combined.head(3)
np.allclose(combined_pred.values,combined.values)<jupyter_output><empty_output><jupyter_text>bf(c670混參比例) 41*2 check  修改前<jupyter_code>np.allclose(c670_df[c670_col['upper_bf']].values+c670_df[c670_col['lower_bf']].values,1.0)
# 根據條件修改值
a = c670_df[c670_col['upper_bf']+c670_col['lower_bf']]
紫色零點零欄位 = a[a==0.0].dropna(axis=1).columns.tolist()
紫色零點一欄位 = a[a==0.1].dropna(axis=1).columns.tolist()
紫色零點九欄位 = a[a==0.9].dropna(axis=1).columns.tolist()
紫色一點零欄位 = a[a==1.0].dropna(axis=1).columns.tolist()
print('修改欄位數量:',len(紫色零點零欄位+紫色零點一欄位+紫色零點九欄位+紫色一點零欄位))
c670_df.loc[:,紫色零點零欄位] = 0.0001 
c670_df.loc[:,紫色零點一欄位] = 0.0001 
c670_df.loc[:,紫色零點九欄位] = 0.9999
c670_df.loc[:,紫色一點零欄位] = 0.9999
c670_df[紫色零點零欄位+紫色零點一欄位+紫色零點九欄位+紫色一點零欄位].head()
index_0001 = 紫色零點零欄位+紫色零點一欄位
index_9999 = 紫色零點九欄位+紫色一點零欄位

# 確認質量平衡
print(np.allclose(c670_df[c670_col['upper_bf']].values+c670_df[c670_col['lower_bf']].values,1.0))

# 用bf轉換成combined
x1 = c670_df.loc[idx,c670_col['xTray43']].values
x2 = c670_df.loc[idx,c670_col['xTray54']].values
bf1 = c670_df.loc[idx,c670_col['upper_bf']].values
bf2 = c670_df.loc[idx,c670_col['lower_bf']].values
print(x1.shape,x2.shape,bf1.shape,bf2.shape)
combined_real = c670_df.loc[idx,c670_col['combined']].values
combined_pred = x1*bf1 + x2*bf2
print(np.allclose(combined_real,combined_pred))
plt.imshow(combined_real[:41])
plt.show()
plt.imshow(combined_pred[:41])<jupyter_output>修改欄位數量: 24
True
(15547, 41) (15547, 41) (15547, 41) (15547, 41)
False<jupyter_text>check massblance<jupyter_code>np.allclose(c620_mb.iloc[:,0].values,c620_mb.iloc[:,1:].sum(axis=1).values),\
np.allclose(c660_mb.iloc[:,0].values,c660_mb.iloc[:,1:].sum(axis=1).values),\
np.allclose(c670_mb.iloc[:,[0,1]].sum(axis=1).values,c670_mb.iloc[:,[2,3]].sum(axis=1).values)
def check_massblance(df,mb,c,name):
  if (name == 'c620') or (name == 'c660'):
    feed = df[c['x41']]*mb.iloc[:,0].values.reshape(-1,1)
    wt1 = df[c['vent_gas_x']]*mb.iloc[:,1].values.reshape(-1,1)
    wt2 = df[c['distillate_x']]*mb.iloc[:,2].values.reshape(-1,1)
    wt3 = df[c['sidedraw_x']]*mb.iloc[:,3].values.reshape(-1,1)
    wt4 = df[c['bottoms_x']]*mb.iloc[:,4].values.reshape(-1,1)
    a = feed.values
    b = wt1.values+wt2.values+wt3.values+wt4.values
    print(np.allclose(a,b,atol=2e-2))
    print('mean error:',np.abs(a-b).mean())
    return pd.DataFrame(a),pd.DataFrame(b)
  elif name == 'c670':
    feed1 = df[c['xTray43']]*mb.loc[:,'Toluene Column C670 Operation_Feed Properties \n@ Tray 43_Mass Flow Rate_ton/hr'].values.reshape(-1,1)
    feed2 = df[c['xTray54']]*mb.loc[:,'Toluene Column C670 Operation_Feed Properties \n@ Tray 54_Mass Flow Rate_ton/hr'].values.reshape(-1,1)
    wt1 = df[c['distillate_x']]*mb.iloc[:,2].values.reshape(-1,1)
    wt2 = df[c['bottoms_x']]*mb.iloc[:,3].values.reshape(-1,1)
    a = feed1.values+feed2.values
    b = wt1.values+wt2.values
    print(np.allclose(a,b,atol=2e-2))
    print('mean error:',np.abs(a-b).mean())
    return pd.DataFrame(a),pd.DataFrame(b)
a,b = check_massblance(c620_df,c620_mb,c620_col,'c620')
idx = a.sample(41).index
plt.imshow(a.loc[idx].values)
plt.show()
plt.imshow(b.loc[idx].values)
a.loc[idx].values,b.loc[idx].values
a,b = check_massblance(c660_df,c660_mb,c660_col,'c660')
idx = a.sample(41).index
plt.imshow(a.loc[idx].values)
plt.show()
plt.imshow(b.loc[idx].values)
a.loc[idx].values,b.loc[idx].values
a,b = check_massblance(c670_df,c670_mb,c670_col,'c670')
idx = a.sample(41).index
plt.imshow(a.loc[idx].values)
plt.show()
plt.imshow(b.loc[idx].values)
a.loc[idx].values,b.loc[idx].values<jupyter_output><empty_output><jupyter_text>用 fna,xna,s_vent,s_dist,s_side,s_bot 算 f_vent,f_dist,f_side,f_bot<jupyter_code>fna = c620_df['Tatoray Stripper C620 Operation_Feed Properties_Mass Flow Rate_ton/hr'].values.reshape(-1,1)
xna = c620_df.filter(regex='Combined Feed to Tatoray Stripper C620_Detailed Composition').iloc[:,:41].values
s_vent = c620_df.filter(regex='Tatoray Stripper C620 Split Factors Calculation_Split Factor for Individual Component to Tatoray Stripper C620 Vent Gas').iloc[:,:41].values
s_dist = c620_df.filter(regex='Tatoray Stripper C620 Split Factors Calculation_Split Factor for Individual Component to Tatoray Stripper C620 Distillate').iloc[:,:41].values
s_side = c620_df.filter(regex='Tatoray Stripper C620 Split Factors Calculation_Split Factor for Individual Component to Tatoray Stripper C620 Sidedraw').iloc[:,:41].values
s_bot = c620_df.filter(regex='Tatoray Stripper C620 Split Factors Calculation_Split Factor for Individual Component to Tatoray Stripper C620 Bottoms').iloc[:,:41].values
f_vent = c620_df['Tatoray Stripper C620 Operation_Vent Gas Production Rate and Composition_Mass Flow Rate_ton/hr'].values
f_dist = c620_df['Tatoray Stripper C620 Operation_Distillate Production Rate and Composition_Mass Flow Rate_ton/hr'].values
f_side = c620_df['Tatoray Stripper C620 Operation_Sidedraw Production Rate and Composition_Mass Flow Rate_ton/hr'].values
f_bot = c620_df['Tatoray Stripper C620 Operation_Bottoms Production Rate and Composition_Mass Flow Rate_ton/hr'].values
print(np.allclose(np.sum(fna*xna*s_vent*0.01,axis=1),f_vent))
print(np.allclose(np.sum(fna*xna*s_dist*0.01,axis=1),f_dist))
print(np.allclose(np.sum(fna*xna*s_side*0.01,axis=1),f_side))
print(np.allclose(np.sum(fna*xna*s_bot*0.01,axis=1),f_bot))<jupyter_output>True
True
True
True<jupyter_text>用 wt 和 mass_flow 算 BF<jupyter_code>c670_df.filter(regex='Flow Rate_ton').head()
c620_bot_x = c620_df[c620_col['bottoms_x']].values
c660_bot_x = c660_df[c660_col['bottoms_x']].values
c620_mf_bot = c620_mb.loc[:,'Tatoray Stripper C620 Operation_Bottoms Production Rate and Composition_Mass Flow Rate_ton/hr'].values.reshape(-1,1)
c660_mf_bot = c660_mb.loc[:,'Benzene Column C660 Operation_Bottoms Production Rate and Composition_Mass Flow Rate_ton/hr'].values.reshape(-1,1)

a = (c620_bot_x*c620_mf_bot)/(c620_bot_x*c620_mf_bot+c660_bot_x*c660_mf_bot)
a = pd.DataFrame(a,columns=c670_col['lower_bf'])
a[list(set(index_9999)&set(a.columns))] = 0.9999
a[list(set(index_0001)&set(a.columns))] = 0.0001

b = 1-a.values
b = pd.DataFrame(b,columns=c670_col['upper_bf'])

print(np.allclose(a,c670_df[c670_col['lower_bf']].values))
print(np.allclose(b,c670_df[c670_col['upper_bf']].values))
joblib.dump(index_9999,'/content/drive/MyDrive/台塑輕油案子/data/c620/cleaned/index_9999.pkl')
joblib.dump(index_0001,'/content/drive/MyDrive/台塑輕油案子/data/c620/cleaned/index_0001.pkl')
idx = np.random.choice([*range(len(a))],size=1)
count = 0
for i,j in zip(a.values[idx[0]],c670_df[c670_col['lower_bf']].values[idx[0]]):
  print(count,i.round(4),j.round(4))
  count += 1
idx = np.random.choice([*range(len(a))],size=1)
for i,j in zip(b.values[idx[0]],c670_df[c670_col['upper_bf']].values[idx[0]]):
  print(i.round(4),j.round(4))<jupyter_output>0.0001 0.0001
0.0001 0.0001
0.0001 0.0001
0.0001 0.0001
0.0001 0.0001
0.0001 0.0001
0.0001 0.0001
0.0064 0.0064
0.0005 0.0005
0.008 0.008
0.0001 0.0001
0.4301 0.4301
0.3642 0.3642
0.7506 0.7506
0.6856 0.6856
0.6407 0.6407
0.7387 0.7387
0.0684 0.0684
0.0655 0.0655
0.0454 0.0454
0.7293 0.7293
0.0 0.0
0.9694 0.9694
0.0 0.0
0.0011 0.0011
0.0021 0.0021
0.0008 0.0008
0.0018 0.0018
0.0001 0.0001
0.9999 0.9999
0.0 0.0
0.0 0.0
0.5904 0.5904
0.0164 0.0164
0.0 0.0
0.0001 0.0001
0.0 0.0
0.0 0.0
0.0 0.0
0.9999 0.9999
0.9999 0.9999<jupyter_text>m3/hr to ton/hr ![img](https://i.imgur.com/8i2JyNI.jpg)<jupyter_code>V615_density = 0.8626
C820_density = 0.8731
T651_density = 0.8749<jupyter_output><empty_output><jupyter_text>c620 m3/hr to ton/hr<jupyter_code>commom_idx = list(set(c620_df.index)&set(icg_df.index))
c620_feed_rate_ton = c620_df.loc[commom_idx,['Tatoray Stripper C620 Operation_Feed Properties_Mass Flow Rate_ton/hr']].values
V615_Btm_m3 = icg_df.loc[commom_idx,'Simulation Case Conditions_Feed Rate_Feed from V615 Btm_m3/hr'].values.reshape(-1,1)
C820_Dist_m3 = icg_df.loc[commom_idx,'Simulation Case Conditions_Feed Rate_Feed from C820 Dist_m3/hr'].values.reshape(-1,1)
V615_Btm_ton = V615_Btm_m3*V615_density
C820_Dist_ton = C820_Dist_m3*C820_density
c620_feed_rate_ton_hat = V615_Btm_ton+C820_Dist_ton
for i,j in zip(c620_feed_rate_ton[:5],c620_feed_rate_ton_hat[:5]):
  print(i,j)
print('max abs error:',abs(c620_feed_rate_ton-c620_feed_rate_ton_hat).max())<jupyter_output>[153.911875] [153.7003]
[185.8758438] [185.6165]
[153.4830469] [153.7003]
[164.2785156] [164.0515]
[164.2785156] [164.0515]
max abs error: 0.26670310000000086<jupyter_text>t651 m3/hr to t651 ton/hr<jupyter_code>commom_idx = list(set(t651_df.index)&set(icg_df.index))
t651_m3 = icg_df.loc[commom_idx,'Simulation Case Conditions_Feed Rate_Feed from T651_m3/hr'].values
t651_ton = t651_df.loc[commom_idx,'Extract Feed from T651_Flow Rate & Temp/Press._Mass Flow Rate_ton/hr'].values
t651_ton_hat = t651_m3*T651_density
for i,j in zip(t651_ton[:5],t651_ton_hat[:5]):
  print(i,j)
print('max abs error:',abs(t651_ton-t651_ton_hat).max())<jupyter_output>80.59575 80.49080000000001
63.07493359 62.9928
80.59575 80.49080000000001
80.59589844 80.49080000000001
67.388375 67.3673
max abs error: 0.13387031000000604<jupyter_text>用 wt 和 mf 估算 sp<jupyter_code>c620_col.keys()
feed_wt = c620_df[c620_col['x41']].values
vent_gas_wt = c620_df[c620_col['vent_gas_x']].values
feed_mf = c620_mb['Combined Feed to Tatoray Stripper C620_Flow Rate_Mass Flow Rate_ton/hr'].values.reshape(-1,1)
vent_gat_mf = c620_mb['Tatoray Stripper C620 Operation_Vent Gas Production Rate and Composition_Mass Flow Rate_ton/hr'].values.reshape(-1,1)
c620_df[c620_col['vent_gas_sf']].head()
vent_gas_sf_hat = pd.DataFrame((vent_gat_mf*vent_gas_wt)/(feed_mf*feed_wt))
vent_gas_sf_hat.index = c620_df.index
vent_gas_sf_hat.columns = c620_col['vent_gas_sf']
vent_gas_sf_hat
vent_gas_sf_hat.update(c620_df[c620_col['vent_gas_sf']])
np.allclose(vent_gas_sf_hat,c620_df[c620_col['vent_gas_sf']])<jupyter_output><empty_output><jupyter_text>icg_input 中的 side_benzene 必須與 c620_wt中的side_benzene 一致<jupyter_code>a = icg_df.filter(regex='Benzene in C620 Sidedraw_wt%')
b = c620_df.filter(regex='Sidedraw Production Rate and Composition_Benzene_wt%')
idx = list(set(a.index)&set(b.index))
a.loc[idx].join(b.loc[idx])<jupyter_output><empty_output><jupyter_text>NA IN BENZENE = 980 對應到c660_side的na加總值<jupyter_code>a = icg_df[['Simulation Case Conditions_Spec 2 : NA in Benzene_ppmw']]
naidx = [1,2,3,4,5,6,8,9,11,13,14,15,20,22,29]
b = c660_df[c660_col['sidedraw_x']].iloc[:,naidx].sum(axis=1).to_frame()*10000
idx = list(set(a.index)&set(b.index))
a.loc[idx].join(b.loc[idx])<jupyter_output><empty_output><jupyter_text>check 分離係數有些數值都是固定不變的<jupyter_code>#'vent_gas_sf','distillate_sf', 'sidedraw_sf', 'bottoms_sf'
c620_sp_col = c620_col['vent_gas_sf']+c620_col['distillate_sf']+c620_col['sidedraw_sf']+c620_col['bottoms_sf']
a = c620_df[c620_sp_col].describe().T
c620_wt_always_same_split_factor_dict = a[a['std']==0]['mean'].to_dict()
joblib.dump(c620_wt_always_same_split_factor_dict,'/content/drive/MyDrive/台塑輕油案子/data/c620/map_dict/c620_wt_always_same_split_factor_dict.pkl')
c620_wt_always_same_split_factor_dict
c660_sp_col = c660_col['vent_gas_sf']+c660_col['distillate_sf']+c660_col['sidedraw_sf']+c660_col['bottoms_sf']
a = c660_df[c660_sp_col].describe().T
c660_wt_always_same_split_factor_dict = a[a['std']==0]['mean'].to_dict()
joblib.dump(c660_wt_always_same_split_factor_dict,'/content/drive/MyDrive/台塑輕油案子/data/c620/map_dict/c660_wt_always_same_split_factor_dict.pkl')
c660_wt_always_same_split_factor_dict
c670_sp_col = c670_col['distillate_sf']+c670_col['bottoms_sf']
a = c670_df[c670_sp_col].describe().T
c670_wt_always_same_split_factor_dict = a[a['std']==0]['mean'].to_dict()
joblib.dump(c670_wt_always_same_split_factor_dict,'/content/drive/MyDrive/台塑輕油案子/data/c620/map_dict/c670_wt_always_same_split_factor_dict.pkl')
c670_wt_always_same_split_factor_dict<jupyter_output><empty_output><jupyter_text>check real data 也是有分離係數是不變得<jupyter_code>c620_df_real = pd.read_excel('/content/drive/MyDrive/台塑輕油案子/data/c620/明志_遷移式學習_訓練資料_寄送版/c620_data.xlsx',index_col=0)
a = c620_df_real[c620_sp_col].describe().T
c620_wt_always_same_split_factor_dict_real = a[a['std']==0]['mean'].to_dict()
set(c620_wt_always_same_split_factor_dict_real)^set(c620_wt_always_same_split_factor_dict)
c660_df_real = pd.read_excel('/content/drive/MyDrive/台塑輕油案子/data/c620/明志_遷移式學習_訓練資料_寄送版/c660_data.xlsx',index_col=0)
a = c660_df_real[c660_sp_col].describe().T
c660_wt_always_same_split_factor_dict_real = a[a['std']==0]['mean'].to_dict()
set(c660_wt_always_same_split_factor_dict_real)^set(c660_wt_always_same_split_factor_dict)
c670_df_real = pd.read_excel('/content/drive/MyDrive/台塑輕油案子/data/c620/明志_遷移式學習_訓練資料_寄送版/c670_data.xlsx',index_col=0)
a = c670_df_real[c670_sp_col].describe().T
c670_wt_always_same_split_factor_dict_real = a[a['std']==0]['mean'].to_dict()
set(c670_wt_always_same_split_factor_dict_real)^set(c670_wt_always_same_split_factor_dict)<jupyter_output><empty_output><jupyter_text>check 推薦模式如何影響op<jupyter_code>x_col = icg_col['x'][-2:]+c620_col['case'][1:2]
X = c620_df.join(icg_df)[x_col].dropna(axis=0)
print(X.shape)
X.head(3)
Y = c620_df[c620_col['yRefluxRate']+c620_col['yHeatDuty']].join(c660_df[c660_col['yRefluxRate']+c660_col['yHeatDuty']]).join(c670_df[c670_col['yRefluxRate']+c670_col['yHeatDuty']])
Y = Y.loc[X.index]
print(Y.shape)
Y.head(3)
X.join(Y).corr().abs().loc[X.columns,Y.columns].style.background_gradient()<jupyter_output><empty_output><jupyter_text>dist rate 對 na in bz<jupyter_code>icg_df[['Simulation Case Conditions_C620 Distillate Rate_m3/hr']].join(c620_df[['Tatoray Stripper C620 Operation_Sidedraw Production Rate and Composition_Benzene_wt%']]).corr()
a = icg_df[['Simulation Case Conditions_C620 Distillate Rate_m3/hr']].join(c620_df[['Tatoray Stripper C620 Operation_Sidedraw Production Rate and Composition_Benzene_wt%']])
plt.scatter(a.iloc[:,0],a.iloc[:,1])
plt.xlabel('Distillate Rate_m3/hr')
plt.ylabel('C620 Operation_Sidedraw Production Rate and Composition_Benzene_wt%')
plt.show()
icg_df_real = pd.read_excel('/content/drive/MyDrive/台塑輕油案子/data/c620/明志_遷移式學習_訓練資料_寄送版/icg_data.xlsx',index_col=0)
icg_df_real[['Simulation Case Conditions_C620 Distillate Rate_m3/hr']].join(c620_df_real[['Tatoray Stripper C620 Operation_Sidedraw Production Rate and Composition_Benzene_wt%']]).corr()
a = icg_df_real[['Simulation Case Conditions_C620 Distillate Rate_m3/hr']].join(c620_df_real[['Tatoray Stripper C620 Operation_Sidedraw Production Rate and Composition_Benzene_wt%']])
plt.xlabel('Distillate Rate_m3/hr')
plt.ylabel('C620 Operation_Sidedraw Production Rate and Composition_Benzene_wt%')
plt.scatter(a.iloc[:,0],a.iloc[:,1])
icg_df['Simulation Case Conditions_C620 Distillate Rate_m3/hr'].unique()
print(len(icg_df['Simulation Case Conditions_C620 Distillate Rate_m3/hr'].unique()))
print(len(icg_df))
icg_df_real['Simulation Case Conditions_C620 Distillate Rate_m3/hr'].unique()
icg_df_real['Simulation Case Conditions_C620 Distillate Rate_m3/hr'].unique()
print(len(icg_df_real['Simulation Case Conditions_C620 Distillate Rate_m3/hr'].unique()))
print(len(icg_df_real))<jupyter_output>7
168<jupyter_text>nainbz 對 distrate<jupyter_code>root = '/content/drive/MyDrive/台塑輕油案子/data/c620/cleaned/'
icg_df = pd.read_csv(root+'icg_train.csv',index_col=0)
icg_df.head()
import matplotlib.pyplot as plt

plt.scatter(icg_df['Simulation Case Conditions_Spec 2 : NA in Benzene_ppmw'],icg_df['Simulation Case Conditions_C620 Distillate Rate_m3/hr'])
plt.xlabel('Simulation Case Conditions_Spec 2 : NA in Benzene_ppmw')
plt.ylabel('Simulation Case Conditions_C620 Distillate Rate_m3/hr')
plt.show()
from sklearn.preprocessing import MinMaxScaler
icg_df_mm = MinMaxScaler().fit_transform(icg_df)
icg_df_mm = pd.DataFrame(icg_df_mm,index=icg_df.index,columns=icg_df.columns)
import seaborn as sb
for i in icg_df_mm['Simulation Case Conditions_Spec 2 : NA in Benzene_ppmw'].unique():
  try:
    sb.kdeplot(icg_df_mm[icg_df_mm['Simulation Case Conditions_Spec 2 : NA in Benzene_ppmw']==i]['Simulation Case Conditions_C620 Distillate Rate_m3/hr'],label=i)
  except:
    pass
plt.legend()
plt.show()<jupyter_output>/usr/local/lib/python3.7/dist-packages/seaborn/distributions.py:306: UserWarning: Dataset has 0 variance; skipping density estimate.
  warnings.warn(msg, UserWarning)
/usr/local/lib/python3.7/dist-packages/seaborn/distributions.py:306: UserWarning: Dataset has 0 variance; skipping density estimate.
  warnings.warn(msg, UserWarning)
/usr/local/lib/python3.7/dist-packages/seaborn/distributions.py:306: UserWarning: Dataset has 0 variance; skipping density estimate.
  warnings.warn(msg, UserWarning)
/usr/local/lib/python3.7/dist-packages/seaborn/distributions.py:306: UserWarning: Dataset has 0 variance; skipping density estimate.
  warnings.warn(msg, UserWarning)<jupyter_text>distrate<jupyter_code>a = icg_df[['Simulation Case Conditions_C620 Distillate Rate_m3/hr']]
b = c660_df[c660_col['sidedraw_x']].iloc[:,naidx]
c = a.join(b)
for i in b.columns:
  plt.scatter(c['Simulation Case Conditions_C620 Distillate Rate_m3/hr'],c[i])
  plt.title(f'Simulation Case Conditions_C620 Distillate Rate_m3/hr with {i}')
  plt.show()<jupyter_output><empty_output><jupyter_text>溫度對苯的影響<jupyter_code>c620_df[c620_col['yControl']+['Tatoray Stripper C620 Operation_Sidedraw Production Rate and Composition_Benzene_wt%']].sample(5)
a = c620_df[c620_col['yControl']+['Tatoray Stripper C620 Operation_Sidedraw Production Rate and Composition_Benzene_wt%']]
plt.scatter(a.iloc[:,0],a.iloc[:,2])
plt.xlabel(a.columns[0])
plt.ylabel(a.columns[2])
plt.show()

a = c620_df[c620_col['yControl']+['Tatoray Stripper C620 Operation_Sidedraw Production Rate and Composition_Benzene_wt%']]
plt.scatter(a.iloc[:,1],a.iloc[:,2])
plt.xlabel(a.columns[1])
plt.ylabel(a.columns[2])
plt.show()<jupyter_output><empty_output><jupyter_text>觀察溫度range<jupyter_code>c620_df[c620_col['yControl'][0]].plot(kind='hist')
plt.legend()
plt.show()
c620_df[c620_col['yControl'][1]].plot(kind='hist')
plt.legend()
plt.show()
c620_col['yControl'][0]
c620_df['Tatoray Stripper C620 Operation_Column Temp Profile_C620 Tray 14 (Control)_oC'].max()<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.1540142794696197, 'fraction_numerical': 0.10330759143231823, 'mean_word_length': 8.371870732817479, 'pattern_counts': {'":': 0, '<': 82, '<?xml version=': 0, '>': 84, 'https://': 1, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 4, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '22', 'dir': 'jupyter-structured-clean-dedup', 'id': '92372', 'license': 'MIT', 'n_tokens_mistral': 10673, 'n_tokens_neox': 9394, 'n_words': 1093, 'path': 'notebook/Data_analysis.ipynb', 'repo_name': 'skywalker0803r/c620', 'size': '20589'}