Pandas Group By and Pick the non-blank value

import pandas
d = pandas.DataFrame([("joe", "", ""), ("joe", "", "company"), ("joe", "9", "")], columns=("name", "age", "company"))
d = d.groupby("name").max()
d = d.reset_index()

Also try those parameters.

 d = d.groupby("name", sort=False, as_index=False).max()

Please note that you column should have a fixed data type of (string, number, none), apply ‘astype()’ before max(). Other wise max() will return NaN as the max value.

for c in d:
  if d[c].dtype == 'O':
    d[c] = d[c].fillna('').astype(str)