Fill NaN in column 2 with median string based on value in column 1 in Python

  pandas, python

I have 2 columns of data with the first column being product codes (all filled out) and the second column with product description.

The first column has all the product codes filled out but there are some rows where the product description (second column) is missing.

For example row 200 has a product code of 145 but the description on that row is empty (NaN). However, there are other rows with product code 145 where the description exists, which is "laptop". I would like to have the description of row 200 to be filled with "laptop" because that’s the description for that product code.

I want to find a solution where I can fill out all NaN values in the second column (product description) based on the first column (product code).

Please help.

Source: Python Questions