edit line if string ends with substring pandas code example Example: edit line if str end with pandas df.loc[df.stime.str.endswith('+2'), 'edate'] = pts['sdate']+1