I want to fill missing values from object column to be replaced with 'any_fixed_prefix' + '_' + 'corresponding index'.
Dataframe look like:
Required Dataframe after applying logic:
I tried several ways, but doesn't work like fillna or map method:
df['col1'].fillna(str(df.index))
or
df['col1].fillna('PRE_' + str(df.index))
DDL to generate DataFrame:
df = pd.DataFrame({'col1': ['A', 'B', np.nan , np.nan ,'E'],
'col2': ['S4', 'S8', 'AA', 'EE', 'T4'],
'col3': [2017, 2019, 2021, 2014, 2011]})

