How to fill missing value based on column comparison Python
Clash Royale CLAN TAG #URR8PPP How to fill missing value based on column comparison Python I want to fill the missing values in col 2 to corresponding col1. import pandas as pd data={"col1":["A","B","C","A","B","C","A","B","A"], "col2":["hey1"," ","hello2","hey2","he1","hello3"," ","","hey1"]} df=pd.DataFrame(data=data) It should fill it with some rules, given below: for example, if A is occuring four times and out of 4, it has corresponding col2 value for three times and fourth one is missing, so missing value should be a combination of all three. Like in this case 3 values are hey1, hey2, hey1. Fourth missing should contain hey2, hey1. Desired output: col1 col2 A hey1 B he1 C hello2 A hey2 B he1 C hello3 A hey1,hey2 B he1 A hey1 ...