import pandas as pd
import numpy as np
aa = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
bb = [10, 21, 10, 21, 21, 10, 23, 23, 25, 25]
cc = [0, 1, 1, 2, 0, 0, 2, 2, 0, 0]
dd = [1, 2, 2, 4, 1, 6, 7, 8, 9, 10]
ee = [10, 21, 21, 21, 10, 10, 23, 23, 25, 25]
ff = [0, 1, 1, 2, 0, 0, 2, 2, 0, 0]
gg = [10, 21, 21, 21, 10, 10, 23, 23, 25, 25]
df_ = pd.DataFrame(
{'id': aa, 'source': bb, 'target': cc, 'x_source': dd, 'x_target': ee, 'y_source': ff, 'y_target': gg})
df_['x_y_source'] = df_[['x_source', 'y_source']].apply(tuple, axis=1)
df_['x_y_target'] = df_[['x_target', 'y_target']].apply(tuple, axis=1)
print(df_)
s_t_dict = list(set(df_['x_y_source'].tolist() + df_['x_y_target'].tolist()))
print(s_t_dict)
aa_list = [i for i in range(1, len(s_t_dict) + 1)]
print(aa_list)
avail = {key: value for key, value in zip(s_t_dict, aa_list)}
print(avail)