Home > OS >  create a correlation matrix with a datetime type index dataset in python
create a correlation matrix with a datetime type index dataset in python

Time:12-29

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)

CodePudding user response:

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.

  • Related