Quantcast
Channel: Is there a way to replace null values with values from another column in dataframe? - Stack Overflow
Viewing all articles
Browse latest Browse all 2

Is there a way to replace null values with values from another column in dataframe?

$
0
0

I am working with dataframe with many missing values. Iam looking for efficient way to replace the missing values. Following is the example of the dataframe:

s/n     Name      Home_Zip      work_zip        Family_zip 1      John      56729         N/A             836AB 2      sawn      N/A           N/A             73836 3      Michael   N/A          839CD            83093 4      Nathan    93932        78393            N/a 5      Jack      N/A          N/A              N/A

Here, I want to fill missing values in Home_Zip in a way that it looks first in work_zip if it isnot null returns that value else it returns the family_zip. If in the case of all the valueare null it returns unknown.

 s/n     Name      Home_Zip     work_zip        Family_zip 1      John      56729         N/A              836AB 2      sawn      73836         N/A              73836 3      Michael   839CD         839CD            83093 4      Nathan    93932         78393            N/a 5      Jack      Unkown        N/A             N/A

Viewing all articles
Browse latest Browse all 2

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>