dfa = pd.read_csv('file1.csv', header=None, na_values=[-1])
dfb = pd.read_csv('file2.csv', header=None, na_values=[-1])
a = dfa.values.flatten()
b = dfb.values.flatten()
a = a[~np.isnan(a)].astype(int)
b = b[~np.isnan(a)].astype(int)
d = dict(zip(a, b))
Overlaying two pandas Dataframes or numpy arrays and creating a key-value dictionary