Question: IMPORTANT INFORMATION: You will be reading data in from a CSV file to create a Pandas DataFrame. Super Bowl Ratings History.csv = Dataset with Super
IMPORTANT INFORMATION: You will be reading data in from a CSV file to create a Pandas DataFrame.
Super Bowl Ratings History.csv = Dataset with Super Bowl Ratings Information (edited)
DATASET FORMAT:
COLUMN HEADINGS: 'SuperBowl', 'Date', 'Network', 'AVG_viewers', 'TOT_viewers', 'Rating', 'Share', '30secAD_Cost$'
NOTE: This data was downloaded from kaggle.com. The data in the CSV file has been edited to remove a few columns and the column heading row.
Reading data from a CSV file
1. Define variable cols as a list of column headings for the Super Bowl Ratings History dataset. The column headings were provided above (blue box)(You should have EIGHT column headings in your list 2. Use pd.read_csv to read the data file('Super Bowl Ratings History.csv') into DF_SUPERBOWL using the column headings defined by cols Remember: To set the column headings, you will need to use the names = parameter 3. Use the .head() command to display the first 10 records of the DataFrame DF_SUPERBOWL.
NOTE:You do not need to use a print(..) statement with the .head() command. As long as it is the last command in a code cell the values will be displayed and the output looks nicer without using print().
4. Set variable SUPERBOWL_COLS to display the columns in DF_SUPERBOWL - REMEMBER there should be 8 5. Set variable SUPERBOWL_SHAPE to the shape of DF_SUPERBOWL 6. Set variable SUPERBOWL_DIMENSIONS to the number of dimensions of DF_SUPERBOWL 7. Set variable SUPERBOWL_DTYPES to the data types Pandas assigned to the DF_SUPERBOWL column data.
8. Create a new DataFrame named DF_SUPERBOWL_VIEWERS containing ONLY 4 COLUMNS from DF_SUPERBOWL - Only copy the following columns to the new DataFrame: 'SuperBowl', 'Date', 'AVG_viewers', 'TOT_viewers' 9. Set variable SUPERBOWL_VIEWERS_SHAPE to the shape of DF_SUPERBOWL_VIEWERS 10. Write DataFrame DF_SUPERBOWL_VIEWERS to a CSV file named: 'Super Bowl Viewers.csv' - Separator should be a comma (,) and encoding 'utf-8'
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
