<jupyter_start><jupyter_text>_____________________________________________________________________________________________________________________________________________________________________ *<jupyter_code>__author__ = '<NAME>'<jupyter_output><empty_output><jupyter_text>*<jupyter_code>import numpy as np
import scipy as sc
import pandas as pd
import seaborn as sns
import missingno as msno
import matplotlib as plt<jupyter_output><empty_output><jupyter_text>*<jupyter_code>pd.options.mode.chained_assignment = None<jupyter_output><empty_output><jupyter_text>*<jupyter_code>press = pd.read_excel('press.xlsx')
parqeut = pd.read_excel('parquet.xlsx')
colleration = pd.read_excel('press_parquet.xlsx')<jupyter_output><empty_output><jupyter_text>*<jupyter_code># copy dataset for creating backdoor
fdf = press.copy()
sdf = parqeut.copy()
cdf = colleration.copy()<jupyter_output><empty_output><jupyter_text>_____________________________________________________________________________________________________________________________________________________________________ *<jupyter_code># working on downtime
def calculation(x,y,z):
    """
    x: planned downtime
    y: unplanned downtime
    z: producing power
    """
    a = (86400*x)/100
    b = ((86400-a)*y)/100
    c = 86400-(a+b)
    d = (c*z)/3600
    e = 86400/d
    
    print('planned downtime duration: {}sn'.format(round(a,2)))
    print('unplanned downtime duration: {}sn'.format(round(b,2)))
    print('active running time: {}sn'.format(round(c,2)))
    print('producing power in active running time: {} unit'.format(round(d,2)))
    print('producing time for one: {}sn'.format(round(e,2)))

counter = 1
press_value = [[4,23,370],[11,26,250],[6,16,375],[24,40,375]]
parquet_value = [[16,43,335],[19,33,416],[21,43,355]]

for i in press_value:
    print('PRESS-{}'.format(counter))
    counter += 1
    calculation(i[0],i[1],i[2])
    print()

counter=1
for i in parquet_value:
    print('PARQUET-{}'.format(counter))
    counter += 1
    calculation(i[0],i[1],i[2])
    print()<jupyter_output>PRESS-1
planned downtime duration: 3456.0sn
unplanned downtime duration: 19077.12sn
active running time: 63866.88sn
producing power in active running time: 6564.1 unit
producing time for one: 13.16sn

PRESS-2
planned downtime duration: 9504.0sn
unplanned downtime duration: 19992.96sn
active running time: 56903.04sn
producing power in active running time: 3951.6 unit
producing time for one: 21.86sn

PRESS-3
planned downtime duration: 5184.0sn
unplanned downtime duration: 12994.56sn
active running time: 68221.44sn
producing power in active running time: 7106.4 unit
producing time for one: 12.16sn

PRESS-4
planned downtime duration: 20736.0sn
unplanned downtime duration: 26265.6sn
active running time: 39398.4sn
producing power in active running time: 4104.0 unit
producing time for one: 21.05sn

PARQUET-1
planned downtime duration: 13824.0sn
unplanned downtime duration: 31207.68sn
active running time: 41368.32sn
producing power in active running time: 3849.55 unit
producing time for one: 2[...]<jupyter_text>_____________________________________________________________________________________________________________________________________________________________________ *<jupyter_code>sdf.info()<jupyter_output><class 'pandas.core.frame.DataFrame'>
RangeIndex: 162 entries, 0 to 161
Data columns (total 5 columns):
a_code      136 non-null object
demand      136 non-null float64
parquet1    161 non-null float64
parquet2    161 non-null float64
parquet3    161 non-null float64
dtypes: float64(4), object(1)
memory usage: 6.4+ KB<jupyter_text>*<jupyter_code>msno.heatmap(sdf);<jupyter_output><empty_output><jupyter_text>*<jupyter_code>sdf.head()
sdf.tail()<jupyter_output><empty_output><jupyter_text>*<jupyter_code>f_product = list(sdf['a_code'].value_counts().index)
s_product = list()
f_product.sort()
counter = 0

for i in range(1,163):
    for j in f_product:
        if j == ('A'+str(i)):
            counter = counter + 1
    if counter != 1:
        s_product.append('A'+str(i))
    counter = 0
    
print(f_product, len(f_product), end='\n\n')
print(s_product, len(s_product))<jupyter_output>['A1', 'A10', 'A102', 'A103', 'A109', 'A11', 'A110', 'A111', 'A112', 'A113', 'A117', 'A118', 'A12', 'A120', 'A121', 'A129', 'A130', 'A131', 'A132', 'A137', 'A138', 'A139', 'A140', 'A141', 'A142', 'A144', 'A145', 'A146', 'A148', 'A149', 'A15', 'A150', 'A151', 'A152', 'A153', 'A154', 'A155', 'A156', 'A157', 'A158', 'A159', 'A16', 'A160', 'A161', 'A17', 'A18', 'A2', 'A20', 'A22', 'A23', 'A24', 'A25', 'A26', 'A27', 'A3', 'A34', 'A35', 'A36', 'A39', 'A4', 'A40', 'A42', 'A43', 'A45', 'A48', 'A49', 'A50', 'A51', 'A52', 'A53', 'A56', 'A57', 'A58', 'A59', 'A6', 'A60', 'A62', 'A63', 'A64', 'A66', 'A67', 'A68', 'A69', 'A7', 'A70', 'A74', 'A75', 'A78', 'A79', 'A81', 'A84', 'A85', 'A87', 'A9', 'A90', 'A91', 'A92', 'A94', 'A95', 'A97', 'A99'] 101

['A5', 'A8', 'A13', 'A14', 'A19', 'A21', 'A28', 'A29', 'A30', 'A31', 'A32', 'A33', 'A37', 'A38', 'A41', 'A44', 'A46', 'A47', 'A54', 'A55', 'A61', 'A65', 'A71', 'A72', 'A73', 'A76', 'A77', 'A80', 'A82', 'A83', 'A86', 'A88', 'A89', 'A93', 'A96', 'A98', 'A100[...]<jupyter_text>*<jupyter_code>sdf = sdf.dropna()<jupyter_output><empty_output><jupyter_text>*<jupyter_code>sdf['a_code'].value_counts()
for i in sdf['a_code'].value_counts().index:
    print(sdf.parquet1[sdf['a_code'] == i]+sdf.parquet2[sdf['a_code'] == i]+sdf.parquet3[sdf['a_code'] == i])<jupyter_output>65    1166.666667
70    1166.666667
76    1166.666667
82    1166.666667
dtype: float64
9      725.0
12     725.0
105    750.0
115    750.0
dtype: float64
73     1166.666667
95     1166.666667
123    1166.666667
dtype: float64
10     725.0
106    750.0
114    750.0
dtype: float64
63     1166.666667
97     1166.666667
125    1166.666667
dtype: float64
69    1166.666667
71    1166.666667
75    1166.666667
dtype: float64
11     725.0
107    750.0
113    750.0
dtype: float64
19    500.0
32    500.0
45    500.0
dtype: float64
68    1166.666667
79    1166.666667
dtype: float64
94     1166.666667
122    1166.666667
dtype: float64
22    166.666667
29    166.666667
dtype: float64
96     1166.666667
124    1166.666667
dtype: float64
120    1166.666667
134    1166.666667
dtype: float64
23    166.666667
28    166.666667
dtype: float64
93     1166.666667
121    1166.666667
dtype: float64
14    500.0
37    500.0
dtype: float64
25    166.666667
30    166.666667
dtype: float64
101    1166.666667
103   [...]<jupyter_text>*<jupyter_code>fancy = (sdf['a_code'] == 'A10')
sdf[fancy]
fancy = (sdf['a_code'] == 'A10')
sdf['parquet1'][9] = 375.0
sdf['parquet3'][9] = 375.0
sdf['parquet1'][12] = 375.0
sdf['parquet3'][12] = 375.0
sdf[fancy]
fancy = (sdf['a_code'] == 'A12')
sdf[fancy]
fancy = (sdf['a_code'] == 'A12')
sdf['parquet1'][11] = 375.0
sdf['parquet3'][11] = 375.0
sdf[fancy]
fancy = (sdf['a_code'] == 'A11')
sdf[fancy]
fancy = (sdf['a_code'] == 'A11')
sdf['parquet1'][10] = 375.0
sdf['parquet3'][10] = 375.0
sdf[fancy]<jupyter_output><empty_output><jupyter_text>*<jupyter_code>sdf.describe().T<jupyter_output><empty_output><jupyter_text>*<jupyter_code>sdf['demand'].sum()
fancy = (sdf['a_code'] == 'A70')
sdf[fancy]<jupyter_output><empty_output><jupyter_text>*<jupyter_code>pearsoncorr = sdf.corr()
pearsoncorr
sns.heatmap(pearsoncorr, 
            xticklabels=pearsoncorr.columns,
            yticklabels=pearsoncorr.columns,
            cmap='RdBu_r',
            annot=True,
            linewidth=0.5);
sc.stats.kendalltau(sdf['parquet1'], sdf['parquet3'],nan_policy='omit')
sc.stats.spearmanr(sdf['parquet1'], sdf['parquet2'],nan_policy='omit')
sc.stats.kendalltau(fdf['press1'], fdf['press4'],nan_policy='omit')<jupyter_output><empty_output><jupyter_text>*<jupyter_code># 000 situation
fancy = ((sdf['parquet1'] == 0.) & (sdf['parquet2'] == 0.) & (sdf['parquet3'] == 0.))
sdf[fancy]
# 001 situation
fancy = ((sdf['parquet1'] == 0.) & (sdf['parquet2'] == 0.) & (sdf['parquet3'] != 0.))
sdf[fancy]
# 010 situation
fancy = ((sdf['parquet1'] == 0.) & (sdf['parquet2'] != 0.) & (sdf['parquet3'] == 0.))
sdf[fancy]
# 011 situation
fancy = ((sdf['parquet1'] == 0.) & (sdf['parquet2'] != 0.) & (sdf['parquet3'] != 0.))
sdf[fancy]
# 100 situation
fancy = ((sdf['parquet1'] != 0.) & (sdf['parquet2'] == 0.) & (sdf['parquet3'] == 0.))
print(len(sdf[fancy].index))
sdf[fancy]
# 101 situation
fancy = ((sdf['parquet1'] != 0.) & (sdf['parquet2'] == 0.) & (sdf['parquet3'] != 0.))
print(len(sdf[fancy].index))
sdf[fancy]
# 110 situation
fancy = ((sdf['parquet1'] != 0.) & (sdf['parquet2'] != 0.) & (sdf['parquet3'] == 0.))
sdf[fancy]
# 111 situation
fancy = ((sdf['parquet1'] != 0.) & (sdf['parquet2'] != 0.) & (sdf['parquet3'] != 0.))
print(len(sdf[fancy].index))
sdf[fancy]<jupyter_output>71<jupyter_text>_____________________________________________________________________________________________________________________________________________________________________ *<jupyter_code>fdf.info()<jupyter_output><class 'pandas.core.frame.DataFrame'>
RangeIndex: 162 entries, 0 to 161
Data columns (total 6 columns):
b_code    136 non-null object
demand    136 non-null float64
press1    161 non-null float64
press2    161 non-null float64
press3    161 non-null float64
press4    161 non-null float64
dtypes: float64(5), object(1)
memory usage: 7.7+ KB<jupyter_text>*<jupyter_code>msno.heatmap(fdf);<jupyter_output><empty_output><jupyter_text>*<jupyter_code>fdf.head()
fdf.tail()<jupyter_output><empty_output><jupyter_text>*<jupyter_code>fancy = (fdf['b_code'] == 'B142')
fdf['press1'][141] = 375.
fdf['press3'][141] = 375.
fdf['press4'][141] = 375.
fdf[fancy]<jupyter_output><empty_output><jupyter_text>*<jupyter_code>f_product = list(fdf['b_code'].value_counts().index)
s_product = list()
f_product.sort()
counter = 0

for i in range(1,163):
    for j in f_product:
        if j == ('B'+str(i)):
            counter = counter + 1
    if counter != 1:
        s_product.append('B'+str(i))
    counter = 0
    
print(f_product, len(f_product), end='\n\n')
print(s_product, len(s_product))<jupyter_output>['B1', 'B10', 'B102', 'B103', 'B11', 'B112', 'B113', 'B117', 'B118', 'B12', 'B129', 'B130', 'B131', 'B132', 'B137', 'B138', 'B139', 'B140', 'B141', 'B142', 'B144', 'B145', 'B148', 'B149', 'B15', 'B150', 'B151', 'B152', 'B153', 'B154', 'B155', 'B156', 'B157', 'B158', 'B159', 'B16', 'B160', 'B161', 'B17', 'B18', 'B2', 'B20', 'B22', 'B23', 'B24', 'B25', 'B26', 'B27', 'B3', 'B34', 'B35', 'B36', 'B39', 'B4', 'B40', 'B42', 'B43', 'B45', 'B49', 'B50', 'B51', 'B52', 'B56', 'B57', 'B58', 'B59', 'B60', 'B62', 'B63', 'B64', 'B66', 'B67', 'B69', 'B70', 'B79', 'B81', 'B84', 'B85', 'B87', 'B9', 'B90', 'B91', 'B92', 'B95', 'B97'] 85

['B5', 'B6', 'B7', 'B8', 'B13', 'B14', 'B19', 'B21', 'B28', 'B29', 'B30', 'B31', 'B32', 'B33', 'B37', 'B38', 'B41', 'B44', 'B46', 'B47', 'B48', 'B53', 'B54', 'B55', 'B61', 'B65', 'B68', 'B71', 'B72', 'B73', 'B74', 'B75', 'B76', 'B77', 'B78', 'B80', 'B82', 'B83', 'B86', 'B88', 'B89', 'B93', 'B94', 'B96', 'B98', 'B99', 'B100', 'B101', 'B104', 'B105', 'B106', 'B107', 'B108'[...]<jupyter_text>*<jupyter_code>fdf.dropna(inplace=True)<jupyter_output><empty_output><jupyter_text>*<jupyter_code>fdf['b_code'].value_counts()
for i in fdf['b_code'].value_counts().index:
    print(fdf.press1[fdf['b_code'] == i]+fdf.press2[fdf['b_code'] == i]+fdf.press3[fdf['b_code'] == i]+fdf.press4[fdf['b_code'] == i])<jupyter_output>10     1125.0
73     1375.0
95     1125.0
106    1125.0
114    1125.0
123    1125.0
dtype: float64
9      1125.0
12     1125.0
98     1125.0
105    1125.0
115    1125.0
126    1125.0
dtype: float64
19    333.333333
32    333.333333
45    333.333333
47    333.333333
dtype: float64
65    1375.0
70    1375.0
76    1375.0
82    1375.0
dtype: float64
11     1125.0
74     1375.0
107    1125.0
113    1125.0
dtype: float64
63     1375.0
97     1125.0
109    1125.0
125    1125.0
dtype: float64
55      333.333333
77     1375.000000
100    1125.000000
dtype: float64
111    1125.0
119    1125.0
133    1125.0
dtype: float64
112    1125.0
120    1125.0
134    1125.0
dtype: float64
8      1125.0
93     1125.0
121    1125.0
dtype: float64
69    1375.0
71    1375.0
75    1375.0
dtype: float64
96     1125.0
108    1125.0
124    1125.0
dtype: float64
56     333.333333
67    1375.000000
88    1375.000000
dtype: float64
94     1125.0
110    1125.0
122    1125.0
dtype: float64
35    333.333333
52    333.333[...]<jupyter_text>*<jupyter_code>fancy = (fdf['b_code'] == 'B11')
fdf[fancy]
fancy = (fdf['b_code'] == 'B11')
fdf['press2'][73] = 0.
fdf[fancy]
fancy = (fdf['b_code'] == 'B12')
fdf[fancy]
fancy = (fdf['b_code'] == 'B12')
fdf['press2'][74] = 0.
fdf[fancy]
fancy = (fdf['b_code'] == 'B64')
fdf[fancy]
fancy = (fdf['b_code'] == 'B64')
fdf['press2'][63] = 0.
fdf[fancy]
fancy = (fdf['b_code'] == 'B57')
fdf[fancy]
fancy = (fdf['b_code'] == 'B57')
fdf['press1'][56] = 375.0
fdf['press2'][56] = 250.0
fdf['press3'][56] = 375.000000
fdf['press4'][56] = 375.0
fdf[fancy]
fancy = (fdf['b_code'] == 'B56')
fdf[fancy]
fancy = (fdf['b_code'] == 'B56')
fdf['press1'][55] = 375.0
fdf['press3'][55] = 375.000000
fdf['press4'][55] = 375.0
fdf['press2'][77] = 0.
fdf[fancy]<jupyter_output><empty_output><jupyter_text>*<jupyter_code>fdf.describe().T<jupyter_output><empty_output><jupyter_text>*<jupyter_code>fdf['demand'].sum()
fancy = (fdf['b_code'] == 'B70')
fdf[fancy]<jupyter_output><empty_output><jupyter_text>*<jupyter_code>pearsoncorr = fdf.corr()
pearsoncorr
sns.heatmap(pearsoncorr, 
            xticklabels=pearsoncorr.columns,
            yticklabels=pearsoncorr.columns,
            cmap='RdBu_r',
            annot=True,
            linewidth=0.5);
sc.stats.spearmanr(fdf['press1'], fdf['press3'],nan_policy='omit')
sc.stats.spearmanr(fdf['press2'], fdf['press3'],nan_policy='omit')
sc.stats.kendalltau(fdf['press1'], fdf['press4'],nan_policy='omit')<jupyter_output><empty_output><jupyter_text>_____________________________________________________________________________________________________________________________________________________________________ *<jupyter_code>pearsoncorr = cdf.corr()
pearsoncorr
sns.heatmap(pearsoncorr, 
            xticklabels=pearsoncorr.columns,
            yticklabels=pearsoncorr.columns,
            cmap='RdBu_r',
            annot=True,
            linewidth=0.5);
sc.stats.spearmanr(cdf['parquet1'], cdf['press1'],nan_policy='omit')
sc.stats.spearmanr(cdf['parquet1'], cdf['press3'],nan_policy='omit')
sc.stats.spearmanr(cdf['parquet1'], cdf['press3'],nan_policy='omit')<jupyter_output><empty_output><jupyter_text>_____________________________________________________________________________________________________________________________________________________________________<jupyter_code>"""
0000
0001
0010
0011
0100
0101
0110
0111
1000
1001
1010
1011
1100
1101
1110
1111
"""
# 0000 situation
fancy = ((fdf['press1'] == 0.) & (fdf['press2'] == 0.) & (fdf['press3'] == 0.) & (fdf['press4'] == 0.))
fdf[fancy]
# 0001 situation
fancy = ((fdf['press1'] == 0.) & (fdf['press2'] == 0.) & (fdf['press3'] == 0.) & (fdf['press4'] != 0.))
fdf[fancy]
# 0010 situation
fancy = ((fdf['press1'] == 0.) & (fdf['press2'] == 0.) & (fdf['press3'] != 0.) & (fdf['press4'] == 0.))
enterance3 = fdf[fancy]
print(len(fdf[fancy].index))
fdf[fancy]
# 0011 situation
fancy = ((fdf['press1'] == 0.) & (fdf['press2'] == 0.) & (fdf['press3'] != 0.) & (fdf['press4'] != 0.))
fdf[fancy]
# 0100 situation
fancy = ((fdf['press1'] == 0.) & (fdf['press2'] != 0.) & (fdf['press3'] == 0.) & (fdf['press4'] == 0.))
fdf[fancy]
# 0101 situation
fancy = ((fdf['press1'] == 0.) & (fdf['press2'] != 0.) & (fdf['press3'] == 0.) & (fdf['press4'] != 0.))
fdf[fancy]
# 0110 situation
fancy = ((fdf['press1'] == 0.) & (fdf['press2'] != 0.) & (fdf['press3'] != 0.) & (fdf['press4'] == 0.))
fdf[fancy]
# 0111 situation
fancy = ((fdf['press1'] == 0.) & (fdf['press2'] != 0.) & (fdf['press3'] != 0.) & (fdf['press4'] != 0.))
fdf[fancy]
# 1000 situation
fancy = ((fdf['press1'] != 0.) & (fdf['press2'] == 0.) & (fdf['press3'] == 0.) & (fdf['press4'] == 0.))
fdf[fancy]
# 1001 situation
fancy = ((fdf['press1'] != 0.) & (fdf['press2'] == 0.) & (fdf['press3'] == 0.) & (fdf['press4'] != 0.))
fdf[fancy]
# 1010 situation
fancy = ((fdf['press1'] != 0.) & (fdf['press2'] == 0.) & (fdf['press3'] != 0.) & (fdf['press4'] == 0.))
fdf[fancy]
# 1011 situation
fancy = ((fdf['press1'] != 0.) & (fdf['press2'] == 0.) & (fdf['press3'] != 0.) & (fdf['press4'] != 0.))
enterance2 = fdf[fancy]
print(len(fdf[fancy].index))
fdf[fancy]
# 1100 situation
fancy = ((fdf['press1'] != 0.) & (fdf['press2'] != 0.) & (fdf['press3'] == 0.) & (fdf['press4'] == 0.))
fdf[fancy]
# 1101 situation
fancy = ((fdf['press1'] != 0.) & (fdf['press2'] != 0.) & (fdf['press3'] == 0.) & (fdf['press4'] != 0.))
fdf[fancy]
# 1110 situation
fancy = ((fdf['press1'] != 0.) & (fdf['press2'] != 0.) & (fdf['press3'] != 0.) & (fdf['press4'] == 0.))
fdf[fancy]
# 1111 situation
fancy = ((fdf['press1'] != 0.) & (fdf['press2'] != 0.) & (fdf['press3'] != 0.) & (fdf['press4'] != 0.))
enterance1 = fdf[fancy]
print(len(fdf[fancy].index))
fdf[fancy]<jupyter_output>42<jupyter_text>_____________________________________________________________________________________________________________________________________________________________________ *<jupyter_code>enterance1['demand'].sum()
enterance2['demand'].sum()
enterance3['demand'].sum()<jupyter_output><empty_output><jupyter_text>_____________________________________________________________________________________________________________________________________________________________________ *<jupyter_code># We created five different dataset after data preprocessing.
#fdf.to_excel('fdf.xlsx')
#sdf.to_excel('sdf.xlsx')
#enterance1.to_excel('enterance1.xlsx')
#enterance2.to_excel('enterance2.xlsx')
#enterance3.to_excel('enterance3.xlsx')<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.20377716935799295, 'fraction_numerical': 0.13896183717941554, 'mean_word_length': 5.201663201663202, 'pattern_counts': {'":': 0, '<': 123, '<?xml version=': 0, '>': 123, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '32', 'dir': 'jupyter-structured-clean-dedup', 'id': '433485', 'license': 'Unlicense', 'n_tokens_mistral': 8796, 'n_tokens_neox': 7354, 'n_words': 1425, 'path': 'hackathon.ipynb', 'repo_name': 'Vodit/simathon20', 'size': '17904'}