Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Create the Contacts DataFrame Choose one of the following two options for extracting and transforming the data from the contacts.xlsx Excel data: Option 1 :
Create the Contacts DataFrame
Choose one of the following two options for extracting and transforming the data from the contacts.xlsx Excel data:
Option : Use Python dictionary methods.
Option : Use regular expressions.
If you chose Option complete the following steps:
Import the contacts.xlsx file into a DataFrame.
Iterate through the DataFrame, converting each row to a dictionary.
Iterate through each dictionary, doing the following:
Extract the dictionary values from the keys by using a Python list comprehension.
Add the values for each row to a new list.
Create a new DataFrame that contains the extracted data.
Split each "name" column value into a first and last name, and place each in a new column.
Clean and export the DataFrame as contacts.csv and save it to your GitHub repository.
If you chose Option complete the following steps:
Import the contacts.xlsx file into a DataFrame.
Extract the "contactid "name", and "email" columns by using regular expressions.
Create a new DataFrame with the extracted data.
Convert the "contactid column to the integer type.
Split each "name" column value into a first and a last name, and place each in a new column.
Clean and then export the DataFrame as contacts.csv and save it to your GitHub repository.
Check that your final DataFrame resembles the one in the following image:
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started