Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

pands correlation matrix to dataframe

correlations = df_no_zeroes_revenue.corr().unstack().sort_values(ascending=False) # Build correlation matrix
correlations = pd.DataFrame(correlations).reset_index() # Convert to dataframe
correlations.columns = ['col1', 'col2', 'correlation'] # Label it
correlations[(corrlations.correlation) > 0.5 & (correlations.correlation < 1)] # to see the highest correlated variables
 
PREVIOUS NEXT
Tagged: #pands #correlation #matrix #dataframe
ADD COMMENT
Topic
Name
8+5 =