0

I have DataFrame like this

A B C D 010 100 NaN 300 020 NaN 200 400 020 100 NaN NaN 030 NaN NaN 19 030 1 NaN NaN 040 NaN 2 1 

How can I merge all rows that have duplicate (same value) in Column A so that other values fill the empty places?

End result

A B C D 010 100 NaN 300 020 100 200 400 030 1 NaN 19 040 NaN 2 1 

1 Answer 1

1

Check with

df=df.groupby('A',as_index=False).first() Out[65]: A B C D 0 10 100.0 NaN 300.0 1 20 100.0 200.0 400.0 2 30 1.0 NaN 19.0 3 40 NaN 2.0 1.0 
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.