
上QQ阅读APP看书,第一时间看更新
How to do it...
Perform the following simple steps to acquire the data needed for the rest of this chapter:
- Download the dataset from: http://www.fueleconomy.gov/feg/epadata/vehicles.csv.zip
- Unzip vehicles.csv with the decompression tool of your choice and move it to your working code directory.
- Take a moment and open the unzipped vehicles.csv file with Microsoft Excel, Google Spreadsheet, or a simple text editor. Comma-separated value (CSV) files are very convenient to work with as they can be edited and viewed with very basic and freely available tools. With the file open, scroll through some of the data and get a sense of what you will be working with.
- Navigate to http://www.fueleconomy.gov/feg/ws/index.shtml#vehicle.
- Select and copy all the text below the vehicle heading under Data Description, and paste it into a text file. Do not include the emissions heading. Save this file in your working directory as varlabels.txt. The first five lines of the file are as follows:
atvtype - type of alternative fuel or advanced technology vehicle
barrels08 - annual petroleum consumption in barrels for fuelType1 (1)
barrelsA08 - annual petroleum consumption in barrels for fuelType2 (1)
charge120 - time to charge an electric vehicle in hours at 120 V
charge240 - time to charge an electric vehicle in hours at 240 V
Note that this file is provided for your convenience in the repository containing this chapter's code.