I have a large dataset in pandas. For brevity, let's say I have the following
df = pd.DataFrame({'col1': [101,101,101,201,201,201,np.nan],
'col2':[123,123,124,np.nan,321,321,456],
'col3':['a',0.7,0.6,1.01,2,1,2],
'col4':['w',0.2,'b',0.7,'z',2,3],
'col5':[21,'z',0.3,2.3,0.8,'z',1.001],
'col6':[11.3,202.0,0.2,0.3,41.0,47,2],
'col7':['A','B','C','D','E','F','G']})
Now I want to create categorical variables with the suffix _missing such that for any column in the dataset that contains missing nan a new column (variable) should be created that has values 1 for 'nan' values and 0 otherwise. For example, for col1 and col2, their corresponding variables will be col1_missing and col2_missing.
Then for columns like col3 that have alphabets in a column that is supposed to be numeric, I will like similar result as described above, but with the levels of categories increasing with the number of different alphabets. For example the new column corresponding to col4 will be col4_missing and will contain 0 for non-alphabets, 1 for b, 2 for w and 3 for z. So the resulting frame should look as below:
Is there any python function or package to do this? As a newbie, I am honestly overwhelmed with this and I would be grateful for any help on this.

