Spaces:
Running
Running
drguilhermeapolinario
commited on
Update views/cad_cid.py
Browse files- views/cad_cid.py +41 -43
views/cad_cid.py
CHANGED
@@ -15,50 +15,48 @@ add_vertical_space(10)
|
|
15 |
#df = load_data()
|
16 |
uploaded_file = st.sidebar.file_uploader("Adicione o arquivo Excel", type= ".xlsx")
|
17 |
if uploaded_file is not None:
|
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 |
-
if uploaded_file is not None:
|
62 |
col1, col2, col3, col4 = st.columns([1, 1, 1, 3])
|
63 |
with col1:
|
64 |
rua_selecionada = st.selectbox("Selecione a Rua", sorted(df["RUA"].unique()))
|
|
|
15 |
#df = load_data()
|
16 |
uploaded_file = st.sidebar.file_uploader("Adicione o arquivo Excel", type= ".xlsx")
|
17 |
if uploaded_file is not None:
|
18 |
+
|
19 |
+
|
20 |
+
# Load the Excel file
|
21 |
+
@st.cache_data
|
22 |
+
def load_data():
|
23 |
+
file_path = uploaded_file
|
24 |
+
df = pd.read_excel(file_path, sheet_name="ANALISE", engine='openpyxl')
|
25 |
+
df["ATUALIZADO"] = pd.to_datetime(df["ATUALIZADO"], errors="coerce", dayfirst=True)
|
26 |
+
df["Trimestre"] = df["ATUALIZADO"].dt.to_period("Q")
|
27 |
+
df["Mês"] = df["ATUALIZADO"].dt.to_period("M")
|
28 |
+
df["Semestre"] = df["ATUALIZADO"].dt.to_period("6M")
|
29 |
+
|
30 |
+
# Convert RUA column to string to ensure consistent sorting
|
31 |
+
df["RUA"] = df["RUA"].astype(str)
|
32 |
+
|
33 |
+
return df
|
34 |
+
|
35 |
+
# Custom CSS for dark theme
|
36 |
+
st.markdown(
|
37 |
+
"""
|
38 |
+
<style>
|
39 |
+
.reportview-container {
|
40 |
+
background: #0e1117;
|
41 |
+
color: #fafafa;
|
42 |
+
}
|
43 |
+
.big-font {
|
44 |
+
font-size:30px !important;
|
45 |
+
font-weight: bold;
|
46 |
+
color: #fafafa;
|
47 |
+
}
|
48 |
+
.stSelectbox [data-baseweb="select"] {
|
49 |
+
background-color: #262730;
|
50 |
+
}
|
51 |
+
.stSelectbox [data-baseweb="select"] > div {
|
52 |
+
background-color: #262730;
|
53 |
+
color: #fafafa;
|
54 |
+
}
|
55 |
+
</style>
|
56 |
+
""",
|
57 |
+
unsafe_allow_html=True,
|
58 |
+
)
|
|
|
59 |
|
|
|
60 |
col1, col2, col3, col4 = st.columns([1, 1, 1, 3])
|
61 |
with col1:
|
62 |
rua_selecionada = st.selectbox("Selecione a Rua", sorted(df["RUA"].unique()))
|