I have 2 columns A(ID) and B, relation is such that for every unique value in column A, there is a fixed value for column 2. But few values in column 2 are 'nan' values, hence I have to substitute them with corresponding values of them from column A. How to do this?
enter image description here So this 'nan' in B is to be replaced with 2, as it has y in col A and for y in col A value for column B is 2. I need to do this for a larger dataset.