Answered step by step
Verified Expert Solution
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:
- 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.
- 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
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