import pandas
fileurl = 'https://archive.ics.uci.edu/ml/machine-learning-databases/iris/iris.data'
names = ['sepal_length','sepal_width','petal_length','petal_width','class']
data = pandas.read_csv(fileurl, names=names)
#Print the correlation
pandas.set_option('display.width', 100)
pandas.set_option('precision', 2)
correlations = data.corr(method='pearson')
print(correlations)
#-1 indicates 100% negative correlation while a positive 1 indicates 100% correlation. 0 Indicates no correlation. Certain algorithms do not work well with correlated data.
sepal_length | sepal_width | petal_length | petal_width | ||
sepal_length | 1.00 | -0.11 | 0.87 | 0.82 | |
sepal_width | -0.11 | 1.00 | -0.42 | -0.36 | |
petal_length | 0.87 | -0.42 | 1.00 | 0.96 | |
petal_width | 0.82 | -0.36 | 0.96 | 1.00 |