-
Notifications
You must be signed in to change notification settings - Fork 0
/
dashboard_table.py
38 lines (34 loc) · 5.5 KB
/
dashboard_table.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
import streamlit as st
import pandas as pd
from datetime import datetime as dt
from datetime import timedelta as td
from time import sleep
number_of_raws = 5
def relabel_idx(col_name):
return 'background-color: blue;'
def table_style(styler):
styler.map_index(relabel_idx,axis ="columns")
styler.set_table_styles([
dict(selector = 'th',props=[('font-size','0.5in')]),
dict(selector = 'td',props=[('font-size', '0.75in')])
])
#styler.hide(subset = ["grand_total"],axis = 1)
styler.format(precision = 2)
return styler
st.set_page_config(page_title = 'Vihang Dashboard',layout="wide")
sample = ["2024-02-17 10:00:00", "2024-02-17 16:00:00", "2024-02-17 10:00:00", "2024-02-17 10:30:00", "2024-02-17 11:00:00", "2024-02-17 11:10:00", "2024-02-17 12:00:00", "2024-02-17 12:10:00", "2024-02-17 12:20:00", "2024-02-17 16:20:00", "2024-02-17 16:50:00", "2024-02-17 17:20:00", "2024-02-17 17:30:00", "2024-02-17 18:20:00", "2024-02-17 18:30:00", "2024-02-17 18:40:00", "2024-02-19 12:40:00", "2024-02-19 16:40:00", "2024-02-19 17:40:00", "2024-02-20 14:40:00", "2024-02-20 15:40:00", "2024-02-17 10:00:00", "2024-02-17 11:20:00", "2024-02-17 11:30:00", "2024-02-17 11:40:00", "2024-02-17 12:00:00", "2024-02-17 12:40:00", "2024-02-17 12:50:00", "2024-02-17 10:00:00", "2024-02-17 10:10:00", "2024-02-17 10:20:00", "2024-02-17 10:27:00", "2024-02-17 10:35:00", "2024-02-17 10:45:00", "2024-02-17 10:55:00", "2024-02-17 11:10:00", "2024-02-17 11:25:00", "2024-02-17 11:45:00", "2024-02-17 10:00:00", "2024-02-17 10:30:00", "2024-02-17 10:50:00", "2024-02-17 11:10:00", "2024-02-17 14:30:00", "2024-02-17 14:45:00", "2024-02-17 14:55:00", "2024-02-17 15:05:00", "2024-02-17 15:20:00", "2024-02-17 15:30:00", "2024-02-17 15:40:00", "2024-02-17 15:55:00", "2024-02-17 16:05:00", "2024-02-17 16:15:00", "2024-02-17 16:30:00", "2024-02-17 16:40:00", "2024-02-17 16:50:00", "2024-02-17 17:20:00", "2024-02-17 17:40:00", "2024-02-17 18:00:00", "2024-02-17 18:30:00", "2024-02-17 18:50:00", "2024-02-17 10:00:00", "2024-02-17 10:10:00", "2024-02-17 10:20:00", "2024-02-17 12:00:00", "2024-02-17 14:40:00", "2024-02-17 16:20:00", "2024-02-17 16:35:00", "2024-02-17 16:50:00", "2024-02-17 10:00:00", "2024-02-17 10:30:00", "2024-02-17 11:30:00", "2024-02-17 12:10:00", "2024-02-17 12:20:00", "2024-02-17 12:35:00", "2024-02-17 12:40:00", "2024-02-17 13:10:00", "2024-02-17 13:15:00", "2024-02-17 14:45:00", "2024-02-17 14:50:00", "2024-02-17 14:55:00", "2024-02-17 15:05:00", "2024-02-17 12:20:00", "2024-02-17 13:30:00", "2024-02-17 15:00:00", "2024-02-17 15:20:00", "2024-02-17 15:40:00", "2024-02-17 16:40:00", "2024-02-17 17:00:00", "2024-02-17 17:35:00", "2024-02-17 17:50:00", "2024-02-17 18:00:00", "2024-02-17 18:10:00", "2024-02-17 18:40:00", "2024-02-17 18:50:00", "2024-02-19 10:25:00", "2024-02-19 10:40:00", "2024-02-17 10:00:00", "2024-02-17 15:20:00", "2024-02-17 16:00:00", "2024-02-17 16:30:00", "2024-02-17 17:00:00", "2024-02-17 17:40:00", "2024-02-17 18:20:00", "2024-02-17 10:00:00", "2024-02-17 19:00:00", "2024-02-19 16:00:00", "2024-02-17 16:00:00", "2024-02-17 18:30:00", "2024-02-17 10:00:00", "2024-02-17 10:15:00", "2024-02-17 10:25:00", "2024-02-17 16:50:00", "2024-02-17 17:05:00", "2024-02-17 17:15:00", "2024-02-17 18:55:00", "2024-02-19 10:25:00", "2024-02-19 10:45:00", "2024-02-17 10:00:00", "2024-02-17 10:15:00", "2024-02-17 10:45:00", "2024-02-17 11:00:00", "2024-02-17 17:00:00", "2024-02-17 17:15:00", "2024-02-17 17:45:00", "2024-02-17 18:00:00", "2024-02-17 12:20:00", "2024-02-17 12:40:00", "2024-02-17 13:00:00", "2024-02-17 15:40:00", "2024-02-17 17:00:00", "2024-02-17 10:00:00", "2024-02-17 10:30:00", "2024-02-17 11:30:00", "2024-02-17 13:30:00", "2024-02-17 16:00:00", "2024-02-17 18:00:00", "2024-02-19 10:00:00", "2024-02-19 12:00:00", "2024-02-17 10:00:00", "2024-02-17 10:08:00", "2024-02-17 10:23:00", "2024-02-17 10:39:00", "2024-02-17 10:49:00", "2024-02-17 11:00:00", "2024-02-17 18:40:00", "2024-02-19 10:10:00", "2024-02-20 16:29:00", "2024-02-21 10:49:00", "2024-02-17 10:35:00", "2024-02-17 10:00:00", "2024-02-17 10:10:00", "2024-02-17 10:30:00", "2024-02-17 11:30:00", "2024-02-17 12:10:00", "2024-02-17 15:50:00", "2024-02-17 16:00:00", "2024-02-17 16:20:00", "2024-02-17 17:20:00", "2024-02-17 18:00:00", "2024-02-17 14:30:00", "2024-02-17 15:30:00", "2024-02-17 15:35:00", "2024-02-17 15:55:00", "2024-02-17 17:00:00", "2024-02-19 10:00:00", "2024-02-19 10:10:00", "2024-02-17 18:30:00", "2024-02-19 10:10:00", "2024-02-19 10:40:00", "2024-02-17 10:20:00", "2024-02-17 12:40:00", "2024-02-17 16:15:00", "2024-02-17 17:25:00", "2024-02-17 17:30:00", "2024-02-19 10:50:00", "2024-02-17 10:00:00", "2024-02-19 10:59:00", "2024-02-17 16:20:00", "2024-02-17 18:50:00", "2024-02-17 17:00:00", "2024-02-17 17:10:00", "2024-02-17 18:00:00", "2024-02-17 18:10:00", "2024-02-17 18:20:00", "2024-02-19 10:20:00", "2024-02-17 17:20:00", "2024-02-17 18:40:00", "2024-02-17 18:30:00", "2024-02-17 10:30:00"]
df = pd.DataFrame(sample,columns = ["Start_time"])
print(df.head())
#df = pd.read_csv("/home/sapuser/Downloads/JC table for given Span of time.csv")
df_shape = list(df.shape)
#print(df1_shape[0])
# as per 5 row per 1 screen how many times we need to slide current screen for 1 frame
if df_shape[0] > 0:
no_of_slide1 = 1 if df_shape[0]%number_of_raws > 0 else 0
no_of_slide1 = no_of_slide1 + df_shape[0]//number_of_raws
#print(df1.iloc[10:16])
st.subheader("SAMPLE TABLE",divider='rainbow')
with st.empty():
for no_of_time in range(no_of_slide1):
st.table(df.iloc[no_of_time*number_of_raws:number_of_raws+(no_of_time*number_of_raws)].style.pipe(table_style))
sleep(15)