Question: You need to do the following data processing using df _ zip : Keep only 5 - digit zip codes in the contbr _ zip

You need to do the following data processing using df_zip :
Keep only 5-digit zip codes in the contbr_zip column.
if zip length is 5-digit long and all are digits, zip has no change.
if zip is missing, assign it "99999"
if zip length is less than 5, assign it as "99999"
if the length is longer than 5, keep only the first 5 digits only if first 5 digits exist
After conversion, display:
(1) the total number of rows,
(2) the first 10 zip_codes, and
(3) last 10 zip_codes
Hints:
work only on the df_zip
use dataframe or series
need to define function
map/apply this function to your data series/dataframe,
if you use a loop, it will be very slow.
You need to do the following data processing

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 Programming Questions!