Advertisement
Guest User

Untitled

a guest
Sep 18th, 2019
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.30 KB | None | 0 0
  1. #convert matrix to list of edges and rename the columns
  2. edges = correlation_matrix.stack().reset_index()
  3. edges.columns = ['asset_1','asset_2','correlation']
  4.  
  5. #remove self correlations
  6. edges = edges.loc[edges['asset_1'] != edges['asset_2']].copy()
  7.  
  8. #show the first 5 rows of the edge list dataframe.
  9. edges.head()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement