Commit ·
d16d6dd
1
Parent(s): d2916af
init commit
Browse files- .idea/.gitignore +8 -0
- .idea/IS_445_Final_Project_Part2.iml +9 -0
- .idea/encodings.xml +4 -0
- .idea/inspectionProfiles/Project_Default.xml +5 -0
- .idea/misc.xml +10 -0
- .idea/modules.xml +8 -0
- .idea/vcs.xml +6 -0
- app.py +92 -62
- data/Electric_Vehicle_Population_Data.csv +3 -0
- data/licenses_fall2022.csv +0 -0
- poetry.lock +0 -0
.idea/.gitignore
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Default ignored files
|
| 2 |
+
/shelf/
|
| 3 |
+
/workspace.xml
|
| 4 |
+
# Editor-based HTTP Client requests
|
| 5 |
+
/httpRequests/
|
| 6 |
+
# Datasource local storage ignored files
|
| 7 |
+
/dataSources/
|
| 8 |
+
/dataSources.local.xml
|
.idea/IS_445_Final_Project_Part2.iml
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?xml version="1.0" encoding="UTF-8"?>
|
| 2 |
+
<module type="JAVA_MODULE" version="4">
|
| 3 |
+
<component name="NewModuleRootManager" inherit-compiler-output="true">
|
| 4 |
+
<exclude-output />
|
| 5 |
+
<content url="file://$MODULE_DIR$" />
|
| 6 |
+
<orderEntry type="inheritedJdk" />
|
| 7 |
+
<orderEntry type="sourceFolder" forTests="false" />
|
| 8 |
+
</component>
|
| 9 |
+
</module>
|
.idea/encodings.xml
ADDED
|
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?xml version="1.0" encoding="UTF-8"?>
|
| 2 |
+
<project version="4">
|
| 3 |
+
<component name="Encoding" native2AsciiForPropertiesFiles="true" />
|
| 4 |
+
</project>
|
.idea/inspectionProfiles/Project_Default.xml
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<component name="InspectionProjectProfileManager">
|
| 2 |
+
<profile version="1.0">
|
| 3 |
+
<option name="myName" value="Project Default" />
|
| 4 |
+
</profile>
|
| 5 |
+
</component>
|
.idea/misc.xml
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?xml version="1.0" encoding="UTF-8"?>
|
| 2 |
+
<project version="4">
|
| 3 |
+
<component name="Black">
|
| 4 |
+
<option name="sdkName" value="Python 3.13 (final-project-part2-u8uBTYck-py3.13)" />
|
| 5 |
+
</component>
|
| 6 |
+
<component name="GOROOT" url="file:///opt/homebrew/opt/go/libexec" />
|
| 7 |
+
<component name="ProjectRootManager" version="2" languageLevel="JDK_11" default="true" project-jdk-name="Python 3.13 (final-project-part2-u8uBTYck-py3.13)" project-jdk-type="Python SDK">
|
| 8 |
+
<output url="file://$PROJECT_DIR$/out" />
|
| 9 |
+
</component>
|
| 10 |
+
</project>
|
.idea/modules.xml
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?xml version="1.0" encoding="UTF-8"?>
|
| 2 |
+
<project version="4">
|
| 3 |
+
<component name="ProjectModuleManager">
|
| 4 |
+
<modules>
|
| 5 |
+
<module fileurl="file://$PROJECT_DIR$/.idea/IS_445_Final_Project_Part2.iml" filepath="$PROJECT_DIR$/.idea/IS_445_Final_Project_Part2.iml" />
|
| 6 |
+
</modules>
|
| 7 |
+
</component>
|
| 8 |
+
</project>
|
.idea/vcs.xml
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?xml version="1.0" encoding="UTF-8"?>
|
| 2 |
+
<project version="4">
|
| 3 |
+
<component name="VcsDirectoryMappings">
|
| 4 |
+
<mapping directory="" vcs="Git" />
|
| 5 |
+
</component>
|
| 6 |
+
</project>
|
app.py
CHANGED
|
@@ -5,78 +5,108 @@
|
|
| 5 |
# 4. Open a Simple Browswer with View --> Command Palette --> Simple Browser: Show
|
| 6 |
# 5. use the URL from prior steps as intput into this simple browser
|
| 7 |
|
| 8 |
-
|
| 9 |
import altair as alt
|
| 10 |
import pandas as pd
|
| 11 |
import streamlit as st
|
| 12 |
|
| 13 |
-
st.title('
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 14 |
|
| 15 |
-
st.
|
|
|
|
|
|
|
|
|
|
| 16 |
|
| 17 |
-
|
|
|
|
| 18 |
|
| 19 |
-
|
| 20 |
-
|
| 21 |
-
licenses_data_filtered.dropna(subset=['LastModifiedDate'], inplace=True)
|
| 22 |
|
| 23 |
-
|
| 24 |
-
license_type_counts = licenses_data_filtered['License Type'].value_counts().head(10).reset_index()
|
| 25 |
-
license_type_counts.columns = ['License Type', 'Count']
|
| 26 |
|
| 27 |
-
|
| 28 |
-
|
| 29 |
-
|
| 30 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 31 |
).properties(
|
| 32 |
-
title='Distribution of Top 10 License Types',
|
| 33 |
width=600,
|
| 34 |
-
height=400
|
| 35 |
-
|
| 36 |
-
|
| 37 |
-
|
| 38 |
-
|
| 39 |
-
|
| 40 |
-
|
| 41 |
-
|
| 42 |
-
|
| 43 |
-
|
| 44 |
-
|
| 45 |
-
|
| 46 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 47 |
).properties(
|
| 48 |
-
title='License Status Over Time (Filtered for Key Statuses)',
|
| 49 |
width=600,
|
| 50 |
-
height=400
|
| 51 |
-
|
| 52 |
-
|
| 53 |
-
|
| 54 |
-
st.
|
| 55 |
-
|
| 56 |
-
st.
|
| 57 |
-
|
| 58 |
-
|
| 59 |
-
|
| 60 |
-
|
| 61 |
-
|
| 62 |
-
|
| 63 |
-
|
| 64 |
-
|
| 65 |
-
|
| 66 |
-
|
| 67 |
-
|
| 68 |
-
|
| 69 |
-
|
| 70 |
-
|
| 71 |
-
|
| 72 |
-
|
| 73 |
-
|
| 74 |
-
|
| 75 |
-
|
| 76 |
-
st.
|
| 77 |
-
|
| 78 |
-
|
| 79 |
-
|
| 80 |
-
|
| 81 |
-
|
| 82 |
-
|
|
|
|
|
|
|
|
|
|
|
|
| 5 |
# 4. Open a Simple Browswer with View --> Command Palette --> Simple Browser: Show
|
| 6 |
# 5. use the URL from prior steps as intput into this simple browser
|
| 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)')
|
| 13 |
+
st.text("Group Members: Nabeel Bashir, Tony An, Devansh Kumar, Jiajun Li")
|
| 14 |
+
|
| 15 |
+
st.text("The URL for this app is: https://huggingface.co/spaces/fa24-is445-group5/Final_Project_Part2")
|
| 16 |
+
|
| 17 |
+
ev_data = pd.read_csv('data/Electric_Vehicle_Population_Data.csv')
|
| 18 |
|
| 19 |
+
st.title('Electric Vehicle Population Data Dashboard')
|
| 20 |
+
st.markdown('''Explore the electric vehicle data interactively using this dashboard.
|
| 21 |
+
This dashboard helps experts and stakeholders understand the distribution and characteristics of electric vehicles
|
| 22 |
+
in various counties and cities.''')
|
| 23 |
|
| 24 |
+
county_list = ev_data['County'].unique()
|
| 25 |
+
make_list = ev_data['Make'].unique()
|
| 26 |
|
| 27 |
+
selected_county = st.sidebar.selectbox('Select County', county_list)
|
| 28 |
+
selected_make = st.sidebar.multiselect('Select Make', make_list, default=make_list)
|
|
|
|
| 29 |
|
| 30 |
+
filtered_data = ev_data[(ev_data['County'] == selected_county) & (ev_data['Make'].isin(selected_make))]
|
|
|
|
|
|
|
| 31 |
|
| 32 |
+
st.subheader('Filtered Data')
|
| 33 |
+
st.write(filtered_data)
|
| 34 |
+
|
| 35 |
+
st.subheader('Distribution of Electric Vehicle Types')
|
| 36 |
+
ev_type_count = filtered_data['Electric Vehicle Type'].value_counts().reset_index()
|
| 37 |
+
ev_type_count.columns = ['Electric Vehicle Type', 'Count']
|
| 38 |
+
|
| 39 |
+
bar_chart = alt.Chart(ev_type_count).mark_bar().encode(
|
| 40 |
+
x=alt.X('Electric Vehicle Type', sort='-y', title='Electric Vehicle Type'),
|
| 41 |
+
y=alt.Y('Count', title='Number of Vehicles'),
|
| 42 |
+
tooltip=['Electric Vehicle Type', 'Count'],
|
| 43 |
+
color='Electric Vehicle Type'
|
| 44 |
).properties(
|
|
|
|
| 45 |
width=600,
|
| 46 |
+
height=400,
|
| 47 |
+
title='Distribution of Electric Vehicle Types in Selected County'
|
| 48 |
+
).interactive()
|
| 49 |
+
|
| 50 |
+
st.altair_chart(bar_chart)
|
| 51 |
+
|
| 52 |
+
st.subheader('Electric Range Distribution')
|
| 53 |
+
electric_range_chart = alt.Chart(filtered_data).mark_bar().encode(
|
| 54 |
+
alt.X('Electric Range', bin=alt.Bin(maxbins=30), title='Electric Range (Miles)'),
|
| 55 |
+
alt.Y('count()', title='Frequency'),
|
| 56 |
+
tooltip=['count()'],
|
| 57 |
+
color=alt.value('steelblue')
|
| 58 |
+
).properties(
|
| 59 |
+
width=600,
|
| 60 |
+
height=400,
|
| 61 |
+
title='Electric Range Distribution in Selected County'
|
| 62 |
+
).interactive()
|
| 63 |
+
|
| 64 |
+
st.altair_chart(electric_range_chart)
|
| 65 |
+
|
| 66 |
+
st.subheader('Vehicle Count by Model Year')
|
| 67 |
+
model_year_count = filtered_data['Model Year'].value_counts().reset_index()
|
| 68 |
+
model_year_count.columns = ['Model Year', 'Count']
|
| 69 |
+
|
| 70 |
+
year_chart = alt.Chart(model_year_count).mark_bar().encode(
|
| 71 |
+
x=alt.X('Model Year:N', sort='-y', title='Model Year'),
|
| 72 |
+
y=alt.Y('Count', title='Number of Vehicles'),
|
| 73 |
+
tooltip=['Model Year', 'Count'],
|
| 74 |
+
color='Model Year:N'
|
| 75 |
).properties(
|
|
|
|
| 76 |
width=600,
|
| 77 |
+
height=400,
|
| 78 |
+
title='Number of Vehicles by Model Year'
|
| 79 |
+
).interactive()
|
| 80 |
+
|
| 81 |
+
st.altair_chart(year_chart)
|
| 82 |
+
|
| 83 |
+
st.subheader('Map of Vehicle Locations')
|
| 84 |
+
|
| 85 |
+
ev_data['Latitude'] = pd.to_numeric(ev_data['Latitude'], errors='coerce')
|
| 86 |
+
ev_data['Longitude'] = pd.to_numeric(ev_data['Longitude'], errors='coerce')
|
| 87 |
+
|
| 88 |
+
filtered_data[['Longitude', 'Latitude']] = filtered_data['Vehicle Location'].str.extract(r'POINT \((-?\d+\.\d+) (-?\d+\.\d+)\)')
|
| 89 |
+
filtered_data['Latitude'] = pd.to_numeric(filtered_data['Latitude'], errors='coerce')
|
| 90 |
+
filtered_data['Longitude'] = pd.to_numeric(filtered_data['Longitude'], errors='coerce')
|
| 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).
|
| 105 |
+
This dataset will provide information about the availability of charging stations in each county, allowing for a deeper
|
| 106 |
+
analysis of the convenience and accessibility of electric vehicles in different regions.
|
| 107 |
+
''')
|
| 108 |
+
|
| 109 |
+
st.markdown('''### Dataset Size
|
| 110 |
+
This dataset is not larger than the GitHub file upload limit, so there is no need to revise the plan for hosting this data.
|
| 111 |
+
''')
|
| 112 |
+
|
data/Electric_Vehicle_Population_Data.csv
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:18ee71403c210c570bbe6786e88436bc21ad7748ab1f5683d94b5bffb711072d
|
| 3 |
+
size 51381679
|
data/licenses_fall2022.csv
DELETED
|
The diff for this file is too large to render.
See raw diff
|
|
|
poetry.lock
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|