I'm working with a pandas dataframe and I want to remove duplicate rows based on the column ID value, but among the duplicate rows, I want to keep the row if the Value column has a value.
I know of
.drop_duplicates(subset="ID", keep="first")
, but that would keep duplicate rows if the Value cells are different.
Input Table:
ID | Value |
---|---|
A | qwer |
B | asdf |
A | |
C |
Output Table:
ID | Value |
---|---|
A | qwer |
B | asdf |
C |
Thanks