keeper_rows = df.ix[[i for i, x in enumerate(df.itertuples()) if 'GE' in x[
    0:2]]]
for row_as_tuple in df.itertuples():
    from_other, to_other, val = row_as_tuple
if 'GE' not in (from_other, to_other):
    new_rows = {'From': ['GE', from_other], 'To': [to_other, 'GE'], 'Val':
        [val, val]}
keeper_rows = pandas.concat([keeper_rows, pandas.DataFrame(new_rows)],
    ignore_index=True)
Duplicating some rows and changing some values in pandas