title: Building and adjacency matrix from 2 column pandas df
body: <p>I am attempting to take a 2 column pandas df (where column 1 is node 1, and column 2 is node 2, thus signifying an edge between the nodes) and converting to adjacency matrix. I have followed the following code snippet from SO (<a href="https://stackoverflow.com/questions/42806398/create-adjacency-matrix-for-two-columns-in-pandas-dataframe">Create adjacency matrix for two columns in pandas dataframe</a>), but this does not create a symmetric matrix, which is what I need. It still makes correct dimension, but help would be greatly appreciated:</p>
  <p>Data:
  <a href="https://i.stack.imgur.com/roALX.png" rel="nofollow noreferrer">2 column df of edges</a></p>
  <p>Code:</p>
  <p><code>df = pd.crosstab(edges_df[0], edges_df[1])</code></p>
  <p><code>idx = df.columns.union(df.index)</code></p>
  <p><code>df = df.reindex(index = idx, columns=idx, fill_value=0)</code></p>