-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapp.py
145 lines (131 loc) · 6.4 KB
/
app.py
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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
import streamlit as st
import tofler # Ensure this is correctly imported
import zauba
import pandas as pd
from IPython.display import HTML, display_html
import streamlit.components.v1 as components
def company_list(csv_file):
df=pd.read_csv(csv_file)
l=[i.replace(" LTD","").replace(" LTD.","") for i in df["Company Name"].to_list()]
return l
# #004c4c
# CSS for styling##ADD8E6
st.markdown("""
<style>
.main {
background-color: #004c4c;
}
.stSelectbox {
background-color: #ADD8E6; /* Background color */
color: white /* Text color */
border: 1px solid #556b2f; /* Border color */
border-radius: 5px; /* Border radius */
}
.stSpinner{
color: white;
}
.heading {
background-color: teal;
margin-top: 5px;
padding: 15px;
text-align: center;
color: white;
font-size: 24px;
font-weight: bold;
border-radius: 10px 10px 0 0;
}
.output-box {
font-size: 20px;
color: #2e4600;
background-color: #c2d9b6;
padding: 20px;
border-radius: 10px;
text-align: center;
margin-top: 20px;
}
div.stButton > button {
width: 100%;
height: 60px;
background-color: teal;
color: white;
font-size: 18px;
border-radius: 12px;
border: none;
}
</style>
""", unsafe_allow_html=True)
st.markdown('<div class="heading">letsCOMPARE</div>', unsafe_allow_html=True)
file_name="Company_list.csv"
company_option=company_list(file_name)
col1, col2 = st.columns(2)
# ['ADANI POWER LIMITED', 'ADANI WATER LIMITED', 'ADANI LOGISTICS LIMITED', 'Option Z']
with col1:
option1 = st.selectbox('Select source of Information:', ['Tofler', 'Zauba Corp'],index=None)
with col2:
option2 = st.selectbox('Select the company:', company_option,index=None)
if st.button('Lets Compare'):
with st.spinner("Fetching Data...."):
if option1 == 'Tofler':
content, fin_table,key_table, reg_dr, directors, asst_table= tofler.content(option2) # Ensure this returns a string or appropriate content
if content=="" and fin_table=="" and key_table=="" and reg_dr=="" and directors=="" and asst_table=="":
st.markdown('<div class="heading">No Data Found. Try Some other company</div>', unsafe_allow_html=True)
# Overview Section
if content!="":
print(content)
st.markdown('<div class="heading">OverView</div>', unsafe_allow_html=True)
st.markdown(f'<div class="output-box">{content}</div>', unsafe_allow_html=True)
# Financial Section
if fin_table!="":
fin_table = pd.DataFrame(fin_table,columns=["","March 2019","March 2020","March 2021","March 2022","March 2023",])
# del fin_table[fin_table.columns[-1]]
fin_table.index = range(1, len(fin_table) + 1)
st.markdown('<div class="heading">Financial Highlights</div>', unsafe_allow_html=True)
# financial_table_html=create_financial_table(fin_table)
# components.html(financial_table_html, height=1000)
st.dataframe(fin_table, use_container_width=True)
# Key Networks
if key_table!="":
table = pd.DataFrame(key_table, columns=["KEY", "VALUE", "INC/DEC"])
table.index = range(1, len(table) + 1)
st.markdown('<div class="heading">Key Metrics</div>', unsafe_allow_html=True)
# st.markdown(f'<div class="output-box">{content_dir}</div>', unsafe_allow_html=True)
st.dataframe(table, use_container_width=True)
# Directors
if directors!="":
table=pd.DataFrame(directors,columns=["Designation","Name","DIN/PAN","Tenure"])
table.index = range(1, len(table) + 1)
st.markdown('<div class="heading">Directors</div>', unsafe_allow_html=True)
# st.markdown(f'<div class="output-box">{content_dir}</div>', unsafe_allow_html=True)
st.dataframe(table,use_container_width=True)
if reg_dr!="":
table = pd.DataFrame(reg_dr, columns=["TYPE", "Value"])
table.index = range(1, len(table) + 1)
st.markdown('<div class="heading">Registration Details</div>', unsafe_allow_html=True)
# st.markdown(f'<div class="output-box">{content_dir}</div>', unsafe_allow_html=True)
st.dataframe(table, use_container_width=True)
if asst_table!="":
table = pd.DataFrame(asst_table, columns=["Asset Name","No. of Loans","Total Amount"])
table.index = range(1, len(table) + 1)
st.markdown('<div class="heading">Charges on Assets</div>', unsafe_allow_html=True)
# st.markdown(f'<div class="output-box">{content_dir}</div>', unsafe_allow_html=True)
st.dataframe(table, use_container_width=True)
# else:
# st.markdown('<div class="heading">No Data Found. Try Some other company</div>', unsafe_allow_html=True)
if option1 == 'Zauba Corp':
content,basic_table,directors_table,past_directors_table = zauba.content(option2) # Ensure this returns a string or appropriate content
if content=="":
st.markdown('<div class="heading">No Data Found. Try other company</div>', unsafe_allow_html=True)
else:
# Overview Section
st.markdown('<div class="heading">Basic Information</div>', unsafe_allow_html=True)
st.markdown(f'<div class="output-box">{content}</div>', unsafe_allow_html=True)
# Financial Section
if list(basic_table)!="":
st.markdown('<div class="heading">Company Details</div>', unsafe_allow_html=True)
st.dataframe(basic_table,use_container_width=True)
if list(directors_table)!="":
st.markdown('<div class="heading">Current Directors Details</div>', unsafe_allow_html=True)
st.dataframe(directors_table,use_container_width=True)
if list(past_directors_table)!="":
st.markdown('<div class="heading">Past Director Details</div>', unsafe_allow_html=True)
st.dataframe(past_directors_table,use_container_width=True)