File size: 961 Bytes
52ae49b
8dbc465
 
 
50bed66
52ae49b
50bed66
 
 
 
 
 
 
 
 
8dbc465
 
 
 
 
50bed66
8dbc465
 
 
 
 
 
 
50bed66
 
 
8dbc465
 
 
50bed66
 
 
 
 
 
 
 
 
8dbc465
 
50bed66
 
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
48
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)