Downlaod Vlaidation
Browse files- appStore/target.py +22 -5
appStore/target.py
CHANGED
|
@@ -28,15 +28,32 @@ _lab_dict = {
|
|
| 28 |
|
| 29 |
@st.cache_data
|
| 30 |
def to_excel(df):
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 31 |
len_df = len(df)
|
| 32 |
output = BytesIO()
|
| 33 |
writer = pd.ExcelWriter(output, engine='xlsxwriter')
|
| 34 |
df.to_excel(writer, index=False, sheet_name='Sheet1')
|
| 35 |
workbook = writer.book
|
| 36 |
worksheet = writer.sheets['Sheet1']
|
| 37 |
-
|
| 38 |
-
|
| 39 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 40 |
writer.save()
|
| 41 |
processed_data = output.getvalue()
|
| 42 |
return processed_data
|
|
@@ -84,7 +101,7 @@ def app():
|
|
| 84 |
def target_display():
|
| 85 |
if 'key1' in st.session_state:
|
| 86 |
df = st.session_state.key1
|
| 87 |
-
|
| 88 |
hits = df[df['Target Label'] == 'TARGET']
|
| 89 |
_lab_dict = {
|
| 90 |
'LABEL_0':'NEGATIVE',
|
|
@@ -150,7 +167,7 @@ def target_display():
|
|
| 150 |
st.write('----------------')
|
| 151 |
st.write('Explore the data')
|
| 152 |
st.write(hits)
|
| 153 |
-
|
| 154 |
|
| 155 |
with st.sidebar:
|
| 156 |
st.write('-------------')
|
|
|
|
| 28 |
|
| 29 |
@st.cache_data
|
| 30 |
def to_excel(df):
|
| 31 |
+
df['Target Validation'] = 'No'
|
| 32 |
+
df['Netzero Validation'] = 'No'
|
| 33 |
+
df['GHG Validation'] = 'No'
|
| 34 |
+
df['Adapt-Mitig Validation'] = 'No'
|
| 35 |
+
df['Sector'] = 'No'
|
| 36 |
len_df = len(df)
|
| 37 |
output = BytesIO()
|
| 38 |
writer = pd.ExcelWriter(output, engine='xlsxwriter')
|
| 39 |
df.to_excel(writer, index=False, sheet_name='Sheet1')
|
| 40 |
workbook = writer.book
|
| 41 |
worksheet = writer.sheets['Sheet1']
|
| 42 |
+
worksheet.data_validation('L2:L{}'.format(len_df),
|
| 43 |
+
{'validate': 'list',
|
| 44 |
+
'source': ['No', 'Yes', 'Discard']})
|
| 45 |
+
worksheet.data_validation('M2:L{}'.format(len_df),
|
| 46 |
+
{'validate': 'list',
|
| 47 |
+
'source': ['No', 'Yes', 'Discard']})
|
| 48 |
+
worksheet.data_validation('N2:L{}'.format(len_df),
|
| 49 |
+
{'validate': 'list',
|
| 50 |
+
'source': ['No', 'Yes', 'Discard']})
|
| 51 |
+
worksheet.data_validation('O2:L{}'.format(len_df),
|
| 52 |
+
{'validate': 'list',
|
| 53 |
+
'source': ['No', 'Yes', 'Discard']})
|
| 54 |
+
worksheet.data_validation('P2:L{}'.format(len_df),
|
| 55 |
+
{'validate': 'list',
|
| 56 |
+
'source': ['No', 'Yes', 'Discard']})
|
| 57 |
writer.save()
|
| 58 |
processed_data = output.getvalue()
|
| 59 |
return processed_data
|
|
|
|
| 101 |
def target_display():
|
| 102 |
if 'key1' in st.session_state:
|
| 103 |
df = st.session_state.key1
|
| 104 |
+
|
| 105 |
hits = df[df['Target Label'] == 'TARGET']
|
| 106 |
_lab_dict = {
|
| 107 |
'LABEL_0':'NEGATIVE',
|
|
|
|
| 167 |
st.write('----------------')
|
| 168 |
st.write('Explore the data')
|
| 169 |
st.write(hits)
|
| 170 |
+
df_xlsx = to_excel(df)
|
| 171 |
|
| 172 |
with st.sidebar:
|
| 173 |
st.write('-------------')
|