I have a dataframe with some NaNs:
hostname period Teff
51 Peg 4.2293 5773
51 Peg 4.231 NaN
51 Peg 4.23077 NaN
55 Cnc 44.3787 NaN
55 Cnc 44.373 NaN
55 Cnc 44.4175 NaN
55 Cnc NaN 5234
61 Vir NaN 5577
61 Vir 38.021 NaN
61 Vir 123.01 NaN
The rows with the same "hostname" all refer to the same object, but as you can see, some entries have NaNs under various columns. I'd like to merge all the rows under the same hostname such that I retain the first finite value in each column (drop the row if all values are NaN). So the result should look like this:
hostname period Teff
51 Peg 4.2293 5773
55 Cnc 44.3787 5234
61 Vir 38.021 5577
How would you go about doing this?