Skip to content

Instantly share code, notes, and snippets.

Avatar

Tianhao Zhou tianhaoz95

View GitHub Profile
View data_extraction.py
import streamlit as st
import pandas as pd
crypto_wallet_history = upload_csv('Crypto)
fiat_wallet_history = upload_csv('Fiat')
visa_card_history = upload_csv('Visa')
features = fetch_feature_flags()
combined_history = pd.concat([crypto_wallet_history, fiat_wallet_history, visa_card_history])
if not combined_history.empty:
View feature_flag_example.py
if 'raw_table' in features:
st.subheader('Raw Table')
st.write(raw_table)
View feature_flag.py
def fetch_feature_flags() -> set[str]:
default_features = ['summary', 'monthly_spending', 'spending_by_category']
optional_features = ['raw_table']
return set(
st.sidebar.multiselect('Features',
default_features + optional_features,
default_features))
View data_input_widget.py
import pandas as pd
import streamlit as st
def construct_timestamp_index(data: pd.DataFrame) -> pd.DataFrame:
data.index = pd.to_datetime(data['Timestamp (UTC)'],
format='%Y-%m-%d %H:%M:%S')
return data.drop(columns=['Timestamp (UTC)'])
def upload_csv(hint: str) -> pd.DataFrame:
uploaded_file = st.sidebar.file_uploader(label=hint)
View app_starter.py
import streamlit as st
st.title('Crypto.com Numbers')
View devcontainer.json
// devcontainer.json
{
"name": "Awesome dev container",
"build": {
"dockerfile": "Dockerfile"
},
"postStartCommand": "git config --global user.email \"${localEnv:VSCODE_CONTAINER_GIT_EMAIL}\" && git config --global user.name \"${localEnv:VSCODE_CONTAINER_GIT_USER}\""
}
View .bashrc
# .bashrc
export VSCODE_CONTAINER_GIT_USER="awesome@gmail.com"
export VSCODE_CONTAINER_GIT_EMAIL="Boba Coder"
View configure_git.sh
git config --global user.email "awesome@gmail.com"
git config --global user.name "Boba Coder"