File size: 1,163 Bytes
e82c355
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1115bb5
 
 
 
 
e82c355
1115bb5
 
e82c355
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
# %%
import pandas as pd
import numpy as np

np.random.seed(24)
df = pd.DataFrame({'A': np.linspace(1, 10, 10)})

df = pd.concat([df, pd.DataFrame(np.random.randn(10, 4), columns=list('BCDE'))],
               axis=1)
df.iloc[0, 2] = np.nan
df['reaction_show'] = True
df
# %%
s = ''
for v in df.reaction_show:
    s += str(int(v))
s


# %%
s = '101100'
g2p = ''
for i in range(len(s)-1):
    # print(i, i+2, s)
    # print(s[0:2])
    g2p += '1' if '1' in s[i:i+2] else '0'

g2p

# %%
# import plotly.express as px
from plotly.offline import init_notebook_mode, iplot
import numpy as np
init_notebook_mode()

x = np.linspace(0, 1)
iplot([{'x': x, 'y': 1-np.exp(-x)}])
# # def highlight_greaterthan(s,column):
# #     is_max = pd.Series(data=False, index=s.index)
# #     is_max[column] = s.loc[column] >= 1
# #     return ['background-color: red' if is_max.any() else '' for v in is_max]

# def highlight_greaterthan_1(s):
#     if s.B > 1.0:
#         return ['background-color: white']+['background-color: yellow']+['background-color: white']*3
#     else:
#         return ['background-color: white']*5


# df.style.apply(highlight_greaterthan_1, axis=1)
# %%