faizhalas commited on
Commit
e13cd47
1 Parent(s): 5f5a8d6

Highlighted the same words.

Browse files
Files changed (1) hide show
  1. pages/1 Keywords Stem.py +8 -2
pages/1 Keywords Stem.py CHANGED
@@ -187,8 +187,14 @@ if uploaded_file is not None:
187
  def table_keyword(extype):
188
  keytab = key.drop(['index'], axis=1).rename(columns={0: 'old'})
189
  return keytab
190
- keytab = table_keyword(extype)
191
- st.dataframe(keytab, use_container_width=True)
 
 
 
 
 
 
192
 
193
  @st.cache_data(ttl=3600)
194
  def convert_dfs(extype):
 
187
  def table_keyword(extype):
188
  keytab = key.drop(['index'], axis=1).rename(columns={0: 'old'})
189
  return keytab
190
+ #===coloring the same keywords===
191
+ @st.cache_data(ttl=3600)
192
+ def highlight_cells(value):
193
+ if keytab['new'].duplicated(keep=False).any() and keytab['new'].duplicated(keep=False)[keytab['new'] == value].any():
194
+ return 'background-color: yellow'
195
+ return ''
196
+ keytab = table_keyword(extype)
197
+ st.dataframe(keytab.style.applymap(highlight_cells, subset=['new']), use_container_width=True, hide_index=True)
198
 
199
  @st.cache_data(ttl=3600)
200
  def convert_dfs(extype):