Fin_Research / app.py
Robert Castagna
rollback
50bed66
raw
history blame
961 Bytes
import streamlit as st
import sqlite3
import pandas as pd
import streamlit as st
import pygwalker as pyg
st.set_page_config(
page_title="Financial Data",
page_icon="📈",
layout="wide",
initial_sidebar_state="expanded",
)
st.set_title('Financial 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
def load_config(file_path):
with open(file_path, 'r') as config_file:
config_str = config_file.read()
return config_str
config = load_config('config.json')
pyg.walk(df, env='Streamlit', dark='dark', spec=config)
# show the dataframe just to test
st.dataframe(df)