File size: 1,062 Bytes
52ae49b
8dbc465
 
 
50bed66
ac1e18e
52ae49b
50bed66
 
 
 
 
 
 
 
8dbc465
ac1e18e
 
8dbc465
 
 
 
50bed66
8dbc465
 
 
 
 
 
 
50bed66
 
 
8dbc465
 
 
ac1e18e
 
9cee292
ac1e18e
 
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
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.to_html(df, dark="dark")
pyg_html = pyg.walk(df, dark = 'dark', return_html=True)

components.html(pyg_html, height=1000, scrolling=True)

# show the dataframe just to test
st.dataframe(df)