pandas.ipynb Ok, it is time for you to try out what you just learned. Let us start with the electric vehicle datafile we have already seen: https://raw.githubusercontent.com/zacharski/datamining-guide/main/data/ElectricCarData_Clean.csv When we loaded the datafile before, it worked fine for those examples, but you may encounter an error here, that will require you to modify the read_csv. []..... Some of the columns are based on kilometers: TopSpeed_KmH Range_Km Efficiency_WhKm FastCharge_KmH and we are first going to add USA mile-centric columns.
pandas.ipynb
Ok, it is time for you to try out what you just learned. Let us start with the electric vehicle datafile we have already seen:
https://raw.githubusercontent.com/zacharski/datamining-guide/main/data/ElectricCarData_Clean.csv
When we loaded the datafile before, it worked fine for those examples, but you may encounter an error here, that will require you to modify the read_csv.
[].....
Some of the columns are based on kilometers:
- TopSpeed_KmH
- Range_Km
- Efficiency_WhKm
- FastCharge_KmH
and we are first going to add USA mile-centric columns.
1. TopSpeed_MPH
Add a new column TopSpeed_MPH computed from the TopSpeed_KmH column, and just to check, display the first 10 rows. (The Lucid Air should have a top speed slightly over 155 MPH)
[].....
2. Range and FastCharge_MPH
Add a new column Range computed from the Range_Km column that shows the range in miles.
Also add a column FastCharge_MPH computed fromFastCharge_KmH`. This will indicate how many miles can you go on one hour of charging.
Just to check, display the first 10 rows. (The Tesla Model 3 Long Range Dual Motor should have a range of nearly 280 miles and charge at a rate of 584 miles per hour of fast charging.)
[].....
3. Efficiency_MkwH
The DataFrame has a column Efficiency_WhKm which indicates how many watt hours does it take to go one kilometer. One common measure of efficieny is how many miles can you go on one kilowatt hour (kwH). So please add this column to the DataFrame. (The Tesla Model 3 Standard Range Plus should have an efficiency of around 4 miles per kilowatt hour.)
[]......
4. New DataFrame
Create a new DataFrame, bevs (battery electric vehicles as opposed to PHEVs) that contain only the following columns from the current DataFrame
- Brand
- Model
- PowerTrain
- AccelSec
- TopSpeed_MPH
- Range
- Efficiency_MkwH
'Brand', 'Model', 'PowerTrain', 'AccelSec', 'TopSpeed_MPH', 'Range', 'Efficiency_MkwH'
[].......
5. Most and least efficient
Using the bevs DataFrame, what are the 5 most efficient evs ordered by the most efficient first?
What are the five most inefficient evs ordered by least efficient first?
[].......
6. fastest
The Porsche 911 997 Turbo S is among the world's fastest production combustion cars with a 0-60 acceleration of 2.9 seconds. (In our dataset AccelSec measures the same thing.) Which electric cars have better acceleration than this? .........
7. Refrigerators
Representative Thomas Massie (R-KY) at a hearing questioning Secretarty Pete Buttigieg says the energy (kWh) required to home charge an electric vehicle for a year is 25 times greater than running the average refrigerator. He also said "It would take four times as much electricity to charge the average household's cars as the average household uses on air conditioning." And he said, "that means the average household would use twice as much electricity charging one of their cars as they would use for all of the air conditioning that they use for the entire year." Is this true?
Since air conditioner use is quite varied in different regions of the country, perhaps a better measure would be the energy used for air conditioning and heating combined.
You are going to need to do some web searching to find the typical energy use of household these household items.
What do you think about the usefulness of this comparing household appliances to EVs when making government policy?
8. Global Adoption of EVs
The data file we are using for this is
https://raw.githubusercontent.com/zacharski/datamining-guide/main/data/IEA-EV-data.csvThis data is from the International Energy Agency.
The first step in data mining work is to examine the dataset, which often is not in the best format to directly answer our questions. That is the case with this file. You have the Pandas skills, but you will need to spend a bit of time looking at the datafile and understanding it, so you can write some code to meet the need.
So what is our need? We are interested in what percent of new car sales are evs in 2021. We are interested in historical data, not predictions. We would like to see the top five countries with the best adoption percent and the bottom five. Have appropriate labels indicating the list of top 5 and bottom 5.
[].......
[].......
9. Adoption of EVs Worldwide Part 2
In the U.S. in 2021 Electric Vehicles account for 2.5% of total new car sales. Is this higher or lower than the average (mean) 2021 figures in our dataset?
Also, how many countries have a higher adoption rate than the U.S?
In addition to cells showing your work, please have some readable content.
[]......
[].......
Trending now
This is a popular solution!
Step by step
Solved in 3 steps