Spaces:
Running
Running
| import streamlit as st | |
| import sqlite3 | |
| import pandas as pd | |
| import streamlit as st | |
| import pygwalker as pyg | |
| import streamlit.components.v1 as components | |
| st.set_page_config( | |
| page_title="Financial Data", | |
| page_icon="📈", | |
| layout="wide", | |
| initial_sidebar_state="expanded", | |
| ) | |
| st.title('Financial Data') | |
| st.subheader('This is a BI tool to analyze news sentiment data') | |
| conn = sqlite3.connect('fin_data.db') | |
| c = conn.cursor() | |
| c.execute(""" | |
| select * from company_news | |
| """) | |
| rows = c.fetchall() | |
| # Extract column names from the cursor | |
| column_names = [description[0] for description in c.description] | |
| conn.commit() | |
| conn.close() | |
| # Create a DataFrame | |
| df = pd.DataFrame(rows, columns=column_names) | |
| # setup pygwalker configuration: https://github.com/Kanaries/pygwalker, https://docs.kanaries.net/pygwalker/use-pygwalker-with-streamlit.en | |
| pyg_html = pyg.walk(df, dark = 'dark', return_html=True) | |
| components.html(pyg_html, height=1000, scrolling=True) | |