Commit ·
5dd9543
1
Parent(s): 8fa333a
map interactive
Browse files- app.py +32 -2
- poetry.lock +1 -1
- pyproject.toml +1 -0
app.py
CHANGED
|
@@ -7,6 +7,7 @@
|
|
| 7 |
|
| 8 |
import altair as alt
|
| 9 |
import pandas as pd
|
|
|
|
| 10 |
import streamlit as st
|
| 11 |
|
| 12 |
st.title('Group 5 Final Project - Part 2 (Dashboard)')
|
|
@@ -91,14 +92,43 @@ filtered_data['Longitude'] = pd.to_numeric(filtered_data['Longitude'], errors='c
|
|
| 91 |
|
| 92 |
filtered_data = filtered_data.dropna(subset=['Latitude', 'Longitude'])
|
| 93 |
filtered_data.rename(columns={'Latitude': 'latitude', 'Longitude': 'longitude'}, inplace=True)
|
| 94 |
-
st.map(filtered_data[['latitude', 'longitude']])
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 95 |
|
| 96 |
st.markdown('''### How to Use This Dashboard
|
| 97 |
To explore the dataset, use the sidebar options to filter by county and make. The filtered dataset is displayed in the
|
| 98 |
table, and corresponding charts will help you explore the distribution of electric vehicle types, their electric ranges,
|
| 99 |
and model years. The map also provides a visualization of the locations of the vehicles in the selected county.
|
| 100 |
|
| 101 |
-
All charts are interactive. You can click on bars to highlight corresponding data points in other charts, making it easier to discover patterns and relationships.
|
|
|
|
|
|
|
| 102 |
|
| 103 |
st.markdown('''### Contextual Datasets
|
| 104 |
A potentially useful contextual dataset could be the [Electric Charging Stations Locations](https://afdc.energy.gov/fuels/electricity_locations.html).
|
|
|
|
| 7 |
|
| 8 |
import altair as alt
|
| 9 |
import pandas as pd
|
| 10 |
+
import pydeck as pdk
|
| 11 |
import streamlit as st
|
| 12 |
|
| 13 |
st.title('Group 5 Final Project - Part 2 (Dashboard)')
|
|
|
|
| 92 |
|
| 93 |
filtered_data = filtered_data.dropna(subset=['Latitude', 'Longitude'])
|
| 94 |
filtered_data.rename(columns={'Latitude': 'latitude', 'Longitude': 'longitude'}, inplace=True)
|
| 95 |
+
# st.map(filtered_data[['latitude', 'longitude']])
|
| 96 |
+
|
| 97 |
+
st.pydeck_chart(pdk.Deck(
|
| 98 |
+
# map_style='mapbox://styles/mapbox/light-v9',
|
| 99 |
+
initial_view_state=pdk.ViewState(
|
| 100 |
+
latitude=filtered_data['latitude'].mean(),
|
| 101 |
+
longitude=filtered_data['longitude'].mean(),
|
| 102 |
+
zoom=10,
|
| 103 |
+
# pitch=50,
|
| 104 |
+
),
|
| 105 |
+
layers=[
|
| 106 |
+
pdk.Layer(
|
| 107 |
+
'ScatterplotLayer',
|
| 108 |
+
data=filtered_data,
|
| 109 |
+
get_position='[longitude, latitude]',
|
| 110 |
+
get_radius=200,
|
| 111 |
+
get_color='[200, 30, 0, 160]',
|
| 112 |
+
pickable=True
|
| 113 |
+
)
|
| 114 |
+
],
|
| 115 |
+
tooltip={
|
| 116 |
+
"html": "<b>Make:</b> {Make}<br/><b>Model:</b> {Model}<br/><b>Electric Range:</b> {Electric Range}",
|
| 117 |
+
"style": {
|
| 118 |
+
"backgroundColor": "steelblue",
|
| 119 |
+
"color": "white"
|
| 120 |
+
}
|
| 121 |
+
}
|
| 122 |
+
))
|
| 123 |
|
| 124 |
st.markdown('''### How to Use This Dashboard
|
| 125 |
To explore the dataset, use the sidebar options to filter by county and make. The filtered dataset is displayed in the
|
| 126 |
table, and corresponding charts will help you explore the distribution of electric vehicle types, their electric ranges,
|
| 127 |
and model years. The map also provides a visualization of the locations of the vehicles in the selected county.
|
| 128 |
|
| 129 |
+
All charts are interactive. You can click on bars to highlight corresponding data points in other charts, making it easier to discover patterns and relationships.
|
| 130 |
+
|
| 131 |
+
The map is also interactive; you can zoom in, rotate, and click on points to see additional information about each vehicle.''')
|
| 132 |
|
| 133 |
st.markdown('''### Contextual Datasets
|
| 134 |
A potentially useful contextual dataset could be the [Electric Charging Stations Locations](https://afdc.energy.gov/fuels/electricity_locations.html).
|
poetry.lock
CHANGED
|
@@ -1183,4 +1183,4 @@ watchmedo = ["PyYAML (>=3.10)"]
|
|
| 1183 |
[metadata]
|
| 1184 |
lock-version = "2.0"
|
| 1185 |
python-versions = "^3.12"
|
| 1186 |
-
content-hash = "
|
|
|
|
| 1183 |
[metadata]
|
| 1184 |
lock-version = "2.0"
|
| 1185 |
python-versions = "^3.12"
|
| 1186 |
+
content-hash = "bd2d59f3fedd9cab57202c080d3ce049a5ad2a45273c567e6aad87cd58d1ebca"
|
pyproject.toml
CHANGED
|
@@ -11,6 +11,7 @@ python = "^3.12"
|
|
| 11 |
streamlit = "^1.40.0"
|
| 12 |
altair = "^5.4.1"
|
| 13 |
vega-datasets = "^0.9.0"
|
|
|
|
| 14 |
|
| 15 |
|
| 16 |
[build-system]
|
|
|
|
| 11 |
streamlit = "^1.40.0"
|
| 12 |
altair = "^5.4.1"
|
| 13 |
vega-datasets = "^0.9.0"
|
| 14 |
+
pydeck = "^0.9.1"
|
| 15 |
|
| 16 |
|
| 17 |
[build-system]
|