Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #convert matrix to list of edges and rename the columns
- edges = correlation_matrix.stack().reset_index()
- edges.columns = ['asset_1','asset_2','correlation']
- #remove self correlations
- edges = edges.loc[edges['asset_1'] != edges['asset_2']].copy()
- #show the first 5 rows of the edge list dataframe.
- edges.head()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement