total_data = pd.read_csv('exams_CODE15.csv')
total_data['diff'] = total_data['nn_predicted_age'] - total_data['age']
And I separate the dataset into 3 groups as i1, i2, and i3. I1 was the group that nn_predicted_age is 8 years greater than age, I2 was the one that nn_predicted_age is 8 years smaller than age, I3 was the one within a range of 8 years from their age
from lifelines import KaplanMeierFitter
i1 = (total_data['diff'] > 8)
i2 = (total_data['diff'] < -8)
i3 = i1+i2
i3 = ~i3
durations = total_data['timey']
event_observed = total_data['death'].astype('int')
kmf_old = KaplanMeierFitter()
kmf_young = KaplanMeierFitter()
kmf = KaplanMeierFitter()
kmf_old.fit(durations[i1], event_observed[i1],label='ECG_age_Old_abs')
a1 = kmf_old.plot()
kmf_young.fit(durations[i2], event_observed[i2],label='ECG_age_Young_abs')
a2 = kmf_young.plot()
kmf.fit(durations[i3], event_observed[i3],label='ECG_age_similar_abs')
kmf.plot(ax=a1)
However, the result that I got from the above code is opposite from your result of the paper.