ppsingh commited on
Commit
ca33833
1 Parent(s): 68daa98

Update appStore/target.py

Browse files
Files changed (1) hide show
  1. appStore/target.py +6 -6
appStore/target.py CHANGED
@@ -8,6 +8,7 @@ import matplotlib.pyplot as plt
8
  import numpy as np
9
  import pandas as pd
10
  import streamlit as st
 
11
  from utils.target_classifier import load_targetClassifier, target_classification
12
  import logging
13
  logger = logging.getLogger(__name__)
@@ -27,7 +28,7 @@ _lab_dict = {
27
  }
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'
@@ -37,9 +38,6 @@ def to_excel(df):
37
  output = BytesIO()
38
  writer = pd.ExcelWriter(output, engine='xlsxwriter')
39
  df.to_excel(writer, index=False, sheet_name='rawdata')
40
- hits = df[df['Target Label'] == 'TARGET']
41
- hits = hits.reset_index(drop=True)
42
- hits = hits.sort_values(by=['Target Score'], ascending=False)
43
  hits = hits.drop(columns = ['Target Score','Netzero Score','GHG Score'])
44
  hits.to_excel(writer,index=False,sheet_name = 'Target')
45
  workbook = writer.book
@@ -106,6 +104,8 @@ def target_display():
106
  st.write('**Economy-wide Related Paragraphs**: `{}`'.format(count_economy))
107
  # st.write('-------------------')
108
  hits = hits.sort_values(by=['Target Score'], ascending=False)
 
 
109
  # netzerohit = hits[hits['Netzero Label'] == 'NETZERO']
110
  # if not netzerohit.empty:
111
  # netzerohit = netzerohit.sort_values(by = ['Netzero Score'], ascending = False)
@@ -133,8 +133,8 @@ def target_display():
133
  # hits = hits.reset_index(drop =True)
134
  st.write('----------------')
135
  st.write('Explore the data')
136
- st.write(hits)
137
- df_xlsx = to_excel(df)
138
 
139
  with st.sidebar:
140
  st.write('-------------')
 
8
  import numpy as np
9
  import pandas as pd
10
  import streamlit as st
11
+ from st_aggrid import AgGrid
12
  from utils.target_classifier import load_targetClassifier, target_classification
13
  import logging
14
  logger = logging.getLogger(__name__)
 
28
  }
29
 
30
  @st.cache_data
31
+ def to_excel(df,hits):
32
  # df['Target Validation'] = 'No'
33
  # df['Netzero Validation'] = 'No'
34
  # df['GHG Validation'] = 'No'
 
38
  output = BytesIO()
39
  writer = pd.ExcelWriter(output, engine='xlsxwriter')
40
  df.to_excel(writer, index=False, sheet_name='rawdata')
 
 
 
41
  hits = hits.drop(columns = ['Target Score','Netzero Score','GHG Score'])
42
  hits.to_excel(writer,index=False,sheet_name = 'Target')
43
  workbook = writer.book
 
104
  st.write('**Economy-wide Related Paragraphs**: `{}`'.format(count_economy))
105
  # st.write('-------------------')
106
  hits = hits.sort_values(by=['Target Score'], ascending=False)
107
+ hits = hits.reset_index(drop=True)
108
+
109
  # netzerohit = hits[hits['Netzero Label'] == 'NETZERO']
110
  # if not netzerohit.empty:
111
  # netzerohit = netzerohit.sort_values(by = ['Netzero Score'], ascending = False)
 
133
  # hits = hits.reset_index(drop =True)
134
  st.write('----------------')
135
  st.write('Explore the data')
136
+ AgGrid(hits)
137
+ df_xlsx = to_excel(df,hits)
138
 
139
  with st.sidebar:
140
  st.write('-------------')