This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if __name__ == '__main__': | |
#Creating PostgreSQL client | |
engine = create_engine('postgresql://<username>:<password>@localhost:5432/<database name>') | |
#Getting session ID | |
session_id = get_session_id() | |
#Creating session state tables | |
engine.execute("CREATE TABLE IF NOT EXISTS %s (size text)" % (session_id)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import streamlit as st | |
import time | |
import random | |
import plotly.express as px | |
import pandas as pd |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
placeholder = st.empty() | |
start_button = st.empty() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def radar_chart(): | |
df = pd.DataFrame(dict( | |
r=[random.randint(0,22), | |
random.randint(0,22), | |
random.randint(0,22), | |
random.randint(0,22), | |
random.randint(0,22)], | |
theta=['processing cost','mechanical properties','chemical stability', | |
'thermal stability', 'device integration'])) | |
fig = px.line_polar(df, r='r', theta='theta', line_close=True) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if start_button.button('Start',key='start'): | |
start_button.empty() | |
if st.button('Stop',key='stop'): | |
pass | |
while True: | |
radar_chart() | |
time.sleep(0.5) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import pandas as pd | |
import streamlit as st | |
import datetime | |
import re | |
import base64 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def df_filter(message,df): | |
slider_1, slider_2 = st.slider('%s' % (message),0,len(df)-1,[0,len(df)-1],1) | |
while len(str(df.iloc[slider_1][1]).replace('.0','')) < 4: | |
df.iloc[slider_1,1] = '0' + str(df.iloc[slider_1][1]).replace('.0','') | |
while len(str(df.iloc[slider_2][1]).replace('.0','')) < 4: | |
df.iloc[slider_2,1] = '0' + str(df.iloc[slider_1][1]).replace('.0','') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def download_csv(name,df): | |
csv = df.to_csv(index=False) | |
base = base64.b64encode(csv.encode()).decode() | |
file = (f'<a href="data:file/csv;base64,{base}" download="%s.csv">Download file</a>' % (name)) | |
return file |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if __name__ == '__main__': | |
df = pd.read_csv('file_path') | |
st.title('Datetime Filter') | |
filtered_df = df_filter('Move sliders to filter dataframe',df) | |
column_1, column_2 = st.beta_columns(2) | |
with column_1: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import streamlit as st | |
import pandas as pd | |
import plotly.express as px | |
import datetime | |
import base64 |