I have a dataframe which looks like this:
X Y Corr_Value
0 51182 51389 1.00
1 51182 50014 NaN
2 51182 50001 0.85
3 51182 50014 NaN
I want to create a new column which consists of the values of X and Y columns. The idea is to loop through the rows, if the Corr_Value is not null , then the new column should show:
Solving (X column value) will solve (Y column value) at (Corr_value column)% probability.
for eg, for the first row the result should be:
Solving 51182 will solve 51389 with 100% probability.
This is the code I wrote:
dfs = []
for i in df1.iterrows():
if ([df1['Corr_Value']] != np.nan):
a = df1['X']
b = df1['Y']
c = df1['Corr_Value']*100
df1['Remarks'] = (f'Solving {a} will solve {b} at {c}% probability')
dfs.append(df1)
df1 is the dataframe which stores the X, Y and Corr_Value data.
But there seems to be a problem because the result I get looks like this:
But the result should look like this:
If you could help me get the desired result, that would be great.

