Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

3f) Masking the Zip Codes In this part, create a for loop, updating thedf_usersdataframe. Go through each user, and update their zip code, to Safe

3f) Masking the Zip Codes

In this part, create a for loop, updating thedf_usersdataframe.

Go through each user, and update their zip code, to Safe Harbor specifications:

  • If the user is from a zip code for the which the "Geographic Subdivision" is less than equal to 20,000, change the zip code in df_users to '0' (as a string)
  • Otherwise, zip should be only the first 3 numbers of the full zip code
  • Do all this by directly updating thezipcolumn of thedf_usersDataFrame

Hints:

  1. This will be several lines of code, looping through the DataFrame, getting each zip code, checking the geographic subdivision with the population inzip_dict, and setting thezip_codeaccordingly.
  2. Be very aware of your variable types when working with zip codes here.

in python

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Programming questions

Question

=+c. Compare that price with the rise in the consumer price index.

Answered: 1 week ago