create a correlation matrix with a datetime type index dataset in python

Question:

I had 2 different dataset and a merge them with:

aaa = pd.merge(time_aragonit, floridaco2, how='inner', on='Time')

This is my dataset after the merge:

enter image description here

I have datetime type index and when i want to create a correlation matrix, the output look like this:
enter image description here

Why is the correlation between the values not shown? Where am i doing wrong could you please help me?

i also tried join but got the same result

aaa=time_aragonit.join(floridaco2)
Asked By: sevil

||

Answers:

In your code you have to draw the correlation matrix.

You are instead creating a heatmap of the data-frame itself.

Make the change as shown below:

corr_carbonate = aaa.corr()
sns.heatmap(corr_carbonate, cmap="YlGnBu", annot=True)

This should give a proper heatmap as you need.

Answered By: shivarama23