File size: 2,819 Bytes
3ddfd7a 5cad389 3ddfd7a 51d9500 3ddfd7a 1219693 3ddfd7a 1219693 3ddfd7a 93d843d 64d50ce dcd5411 3c661a9 dcd5411 3c661a9 1219693 3ddfd7a 1219693 3ddfd7a 1219693 6c979cb | 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 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 | # INSTRUCTIONS:
# 1. Open a "Terminal" by: View --> Terminal OR just the "Terminal" through the hamburger menu
# 2. run in terminal with: streamlit run app.py
# 3. click the "Open in Browser" link that pops up OR click on "Ports" and copy the URL
# 4. Open a Simple Browswer with View --> Command Palette --> Simple Browser: Show
# 5. use the URL from prior steps as intput into this simple browser
import streamlit as st
import altair as alt
import pandas as pd
from vega_datasets import data
st.title('Vizualization for Experts')
st.subheader('This page will contain the entire dashboard.')
st.text("*Dashboard Introduction*")
st.text("*Brief description of Narrative*")
st.text("*World map viz here*")
st.text("*Interactive viz here*")
'''
####### Loading Data #######
# 1. Contracts data
data = pd.read_csv("/Users/sharanya/Documents/SEMESTERS/7- FALL 2024/IS445/FinalProject/IS445_VizForExperts/contract_awards_in_investment_project_financing.csv")
# 2. World Map dataset
world_map = alt.topo_feature(data.world_110m.url, feature='countries')
####### Loading Data #######
from iso3166 import countries_by_name
'''
import pandas as pd
import altair as alt
import ipywidgets as widgets
from IPython.display import display, clear_output
alt.data_transformers.disable_max_rows()
url = "contract_awards_in_investment_project_financing_22-11-2024.csv"
df = pd.read_csv(url)
numeric_columns = df.select_dtypes(include=['float64', 'int64']).columns
col1_dropdown = widgets.Dropdown(
options=numeric_columns,
value=numeric_columns[0],
description="Column 1:"
)
col2_dropdown = widgets.Dropdown(
options=numeric_columns,
value=numeric_columns[1],
description="Column 2:"
)
output = widgets.Output()
def update_correlation(change):
with output:
clear_output(wait=True)
col1 = col1_dropdown.value
col2 = col2_dropdown.value
correlation_value = df[col1].corr(df[col2])
print(f"Correlation between {col1} and {col2}: {correlation_value:.2f}")
# Create a scatter plot
correlation_plot = (
alt.Chart(df)
.mark_circle(size=60)
.encode(
x=alt.X(f"{col1}:Q", title=col1),
y=alt.Y(f"{col2}:Q", title=col2),
color="Region:N",
tooltip=["Project Name", "Supplier", col1, col2],
)
.properties(
title=f"Correlation Plot: {col1} vs. {col2}",
width=600,
height=400
)
)
display(correlation_plot)
col1_dropdown.observe(update_correlation, names='value')
col2_dropdown.observe(update_correlation, names='value')
print("Select columns for correlation analysis:")
display(col1_dropdown, col2_dropdown, output) |