Quantcast
Channel: Is there a way to replace null values with values from another column in dataframe? - Stack Overflow
Browsing index pages (2 articles)
↧

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

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...

View Article


Answer by Quang Hoang for Is there a way to replace null values with values...

You can use bfill followed by fillna().df['Home_Zip'] = df.iloc[:, 2:].bfill(1).fillna('Unknown')['Home_Zip']Or chain several fillna:df['Home_Zip'] = (df['Home_Zip'].fillna(df['work_zip'])...

View Article

Browsing index pages (2 articles)


Latest Images