<jupyter_start><jupyter_text>Find The Correlation Between Columns Suppose you have a DataFrame of numerical values, for example:<jupyter_code>import pandas as pd
import numpy as np
df = pd.DataFrame(np.random.randn(1000, 3), columns=['a', 'b', 'c'])
df
df.corr()<jupyter_output><empty_output><jupyter_text>Here will find the Pearson correlation between the columns. Note how the diagonal is 1, as each columnis (obviously) fully correlated with itself.DOC:https://pandas.pydata.org/docs/reference/api/pandas.DataFrame.corr.htmlDOC:https://www.geeksforgeeks.org/python-pandas-dataframe-corr/ pd.DataFrame.correlation takes an optional method parameter, specifying which algorithm to use.The default is pearson. To use Spearman correlation, for example, use<jupyter_code>df.corr(method='spearman')<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.10424242424242425, 'fraction_numerical': 0.007272727272727273, 'mean_word_length': 6.866666666666666, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, 'https://': 2, 'lorem ipsum': 0, 'www.': 1, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '2', 'dir': 'jupyter-structured-clean-dedup', 'id': '216958', 'license': 'MIT', 'n_tokens_mistral': 274, 'n_tokens_neox': 252, 'n_words': 73, 'path': '6.Computations Tools in pandas.ipynb', 'repo_name': 'yadav-vikas/Pandas-tutorial-for-beginners', 'size': '825'}