0

I have this dataframe(df)

   A Column1      Column2
0  0  Value1              
1  1                    
2  2  Value2   some value
3  3  Value3            

And I want the to replace all empty value from just column2 with specific string "Its Empty"

   A Column1      Column2
0  0  Value1     Its Empty         
1  1             Its Empty       
2  2  Value2    some value
3  3  Value3     Its Empty

1 Answer 1

2

Try with assign loc

df.loc[df['Column2']=='','Column2'] = 'Its Empty'

Or replace

df['Column2'].replace({'':'Its Empty'},inplace=True)
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.