drguilhermeapolinario commited on
Commit
04167b5
·
verified ·
1 Parent(s): aab3696

Update views/cad_cid.py

Browse files
Files changed (1) hide show
  1. 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
- df = load_data()
19
-
20
-
21
- # Load the Excel file
22
- @st.cache_data
23
- def load_data():
24
- file_path = uploaded_file
25
- df = pd.read_excel(file_path, sheet_name="ANALISE", engine='openpyxl')
26
- df["ATUALIZADO"] = pd.to_datetime(df["ATUALIZADO"], errors="coerce", dayfirst=True)
27
- df["Trimestre"] = df["ATUALIZADO"].dt.to_period("Q")
28
- df["Mês"] = df["ATUALIZADO"].dt.to_period("M")
29
- df["Semestre"] = df["ATUALIZADO"].dt.to_period("6M")
30
-
31
- # Convert RUA column to string to ensure consistent sorting
32
- df["RUA"] = df["RUA"].astype(str)
33
-
34
- return df
35
-
36
- # Custom CSS for dark theme
37
- st.markdown(
38
- """
39
- <style>
40
- .reportview-container {
41
- background: #0e1117;
42
- color: #fafafa;
43
- }
44
- .big-font {
45
- font-size:30px !important;
46
- font-weight: bold;
47
- color: #fafafa;
48
- }
49
- .stSelectbox [data-baseweb="select"] {
50
- background-color: #262730;
51
- }
52
- .stSelectbox [data-baseweb="select"] > div {
53
- background-color: #262730;
54
- color: #fafafa;
55
- }
56
- </style>
57
- """,
58
- unsafe_allow_html=True,
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()))