Question: For the second exercise (40 points) use Python Panda, Regular Expressions, .map() and other functions as appropriate to format existing address records and eliminate records

For the second exercise (40 points) use Python Panda, Regular Expressions, .map() and other functions as appropriate to format existing address records and eliminate records with missing critical fields. Critical fields include FirstName, Lastname, Zipcode+4, and Phone number for customers. For this exercise, create an array to hold data with these 4 fields containing at least 25 records.

The Zipcode field should contain either traditional 5-digit Zipcode (e.g. 21801) or Zip+4 format (e.g 21801-1101). The phone numbers should contain 10-digit (e.g. 5555555555) or formatted 10-digit (e.g. 555-555-5555). Some records might be corrupt so the data needs to be munged. At this point, we assume only U.S data will be present therefor country code is not needed.

A few records, data might look like this:

Jim, Robertson, 21801,555-555-5555 John, Adams, 223211143, 4444444444 Helen, Cooper, edskd-2134,323232 ,Franklin,234511, 323-333-2211

You python code should label each column, properly format the Zip code to be either 11111 or 11111-1111 formats, properly format the phone numbers to always be 111-111-1111 format, and replace incorrect values with a blank string.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!