< Home
Week 1: Data analysis¶
Data analysis is the process of examining and interpreting data to find useful insights. It involves collecting information, cleaning it to remove errors, organizing it into clear formats, and then using tools like statistics, coding, or visualization to identify patterns and trends. The results help explain what happened, why it happened, predict future outcomes, and suggest actions. In short, data analysis turns raw numbers into meaningful stories that support better decisions.
First Data analysis¶
In [3]:
import pandas as pd
dataset = pd.read_csv("datasets/Electric_Vehicle_Population_Data.csv")
dataset.head()
Out[3]:
| VIN (1-10) | County | City | State | Postal Code | Model Year | Make | Model | Electric Vehicle Type | Clean Alternative Fuel Vehicle (CAFV) Eligibility | Electric Range | Base MSRP | Legislative District | DOL Vehicle ID | Vehicle Location | Electric Utility | 2020 Census Tract | |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 0 | 3C3CFFGE1G | Yakima | Yakima | WA | 98908.0 | 2016 | FIAT | 500 | Battery Electric Vehicle (BEV) | Clean Alternative Fuel Vehicle Eligible | 84.0 | 0.0 | 14.0 | 180778377 | POINT (-120.60199 46.59817) | PACIFICORP | 5.307700e+10 |
| 1 | WP0AB2Y16L | King | Auburn | WA | 98092.0 | 2020 | PORSCHE | TAYCAN | Battery Electric Vehicle (BEV) | Clean Alternative Fuel Vehicle Eligible | 203.0 | 0.0 | 47.0 | 277717723 | POINT (-122.18497 47.28825) | PUGET SOUND ENERGY INC||CITY OF TACOMA - (WA) | 5.303303e+10 |
| 2 | 5YJ3E1EB2J | King | Seattle | WA | 98109.0 | 2018 | TESLA | MODEL 3 | Battery Electric Vehicle (BEV) | Clean Alternative Fuel Vehicle Eligible | 215.0 | 0.0 | 36.0 | 475865722 | POINT (-122.35022 47.63824) | CITY OF SEATTLE - (WA)|CITY OF TACOMA - (WA) | 5.303301e+10 |
| 3 | 5YJYGDEF5L | King | Seattle | WA | 98125.0 | 2020 | TESLA | MODEL Y | Battery Electric Vehicle (BEV) | Clean Alternative Fuel Vehicle Eligible | 291.0 | 0.0 | 46.0 | 108837249 | POINT (-122.30253 47.72656) | CITY OF SEATTLE - (WA)|CITY OF TACOMA - (WA) | 5.303300e+10 |
| 4 | 5YJXCBE22J | Thurston | Olympia | WA | 98501.0 | 2018 | TESLA | MODEL X | Battery Electric Vehicle (BEV) | Clean Alternative Fuel Vehicle Eligible | 238.0 | 0.0 | 22.0 | 259851259 | POINT (-122.89165 47.03954) | PUGET SOUND ENERGY INC | 5.306701e+10 |
In [8]:
dataset.tail()
Out[8]:
| VIN (1-10) | County | City | State | Postal Code | Model Year | Make | Model | Electric Vehicle Type | Clean Alternative Fuel Vehicle (CAFV) Eligibility | Electric Range | Base MSRP | Legislative District | DOL Vehicle ID | Vehicle Location | Electric Utility | 2020 Census Tract | |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 134604 | 5LMTJ5DZ7R | Snohomish | Lynnwood | WA | 98036.0 | 2024 | LINCOLN | CORSAIR | Plug-in Hybrid Electric Vehicle (PHEV) | Not eligible due to low battery range | 28.0 | 0.0 | 32.0 | 278800812 | POINT (-122.29245 47.82557) | PUGET SOUND ENERGY INC | 5.306105e+10 |
| 134605 | 5YJ3E1EB2K | Kitsap | Bremerton | WA | 98310.0 | 2019 | TESLA | MODEL 3 | Battery Electric Vehicle (BEV) | Clean Alternative Fuel Vehicle Eligible | 220.0 | 0.0 | 23.0 | 262840868 | POINT (-122.61273 47.57428) | PUGET SOUND ENERGY INC | 5.303508e+10 |
| 134606 | WA1M2BFZ2R | Pierce | University Place | WA | 98467.0 | 2024 | AUDI | Q4 | Battery Electric Vehicle (BEV) | Eligibility unknown as battery range has not b... | 0.0 | 0.0 | 28.0 | 258683540 | POINT (-122.54045 47.20742) | BONNEVILLE POWER ADMINISTRATION||CITY OF TACOM... | 5.305307e+10 |
| 134607 | JTMAB3FV8R | Lewis | Winlock | WA | 98596.0 | 2024 | TOYOTA | RAV4 PRIME (PHEV) | Plug-in Hybrid Electric Vehicle (PHEV) | Clean Alternative Fuel Vehicle Eligible | 42.0 | 0.0 | 20.0 | 263054417 | POINT (-122.93881 46.49114) | PUGET SOUND ENERGY INC||CITY OF TACOMA - (WA) | 5.304197e+10 |
| 134608 | 1N4AZ0CP8F | Kitsap | Silverdale | WA | 98383.0 | 2015 | NISSAN | LEAF | Battery Electric Vehicle (BEV) | Clean Alternative Fuel Vehicle Eligible | 84.0 | 0.0 | 23.0 | 218674347 | POINT (-122.69275 47.65171) | PUGET SOU | NaN |
In [19]:
import matplotlib.pyplot as plt
plt.hist(dataset["Electric Range"], bins=30)
plt.xlabel("Electric Vehicle Type")
plt.ylabel("Electric Range")
plt.title("Electric Vehicle data")
plt.show()