Spaces:
Sleeping
Sleeping
File size: 1,446 Bytes
efd5e46 50e759f 1439995 efd5e46 50e759f d22be69 712f953 d22be69 712f953 d22be69 463455f d22be69 463455f 1439995 463455f 0ee2145 463455f 1439995 463455f |
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 |
import streamlit as st
import pandas as pd
from wordcloud import WordCloud
import re
from wordcloud import STOPWORDS
st.set_page_config(
page_title="ESG for All",
layout="wide",
initial_sidebar_state="expanded")
df = pd.read_csv('all_filings_esg_text.csv')
with st.sidebar:
st.title('ESG for All')
year_list = list(df.Year.unique())[::-1]
year_list = sorted(year_list)
selected_year = st.selectbox('Select a year', year_list, index=len(year_list)-1)
df_selected_year = df[df.Year == selected_year]
cik_list = list(df.CIK.unique())[::-1]
cik_list = sorted(cik_list)
selected_cik = st.selectbox('Select a company', cik_list, index=len(cik_list)-1)
df_selected_cik = df[df.CIK == selected_cik]
color_theme_list = ['blues', 'cividis', 'greens', 'inferno', 'magma', 'plasma', 'reds', 'rainbow', 'turbo', 'viridis']
selected_color_theme = st.selectbox('Select a color theme', color_theme_list)
def make_esgScoresPlot(df, cik):
to_display = df[df['CIK'] == cik]
to_display['Year'] = to_display['Year'].astype('string')
to_display.sort_values('Year', inplace=True)
to_display.set_index('Year', inplace=True)
return st.linechart(data=to_display[['e_score', 's_score', 'g_score']])
col = st.columns((1.5, 4.5, 2), gap='medium')
with col[1]:
st.markdown('#### ESG Scores')
esgScoresPlot = make_esgScoresPlot(df, selected_cik)
esgScoresPlot
|