-1

I have the following dataframe

      product_id.       averageDemand
 0     655                 7.591781
 1     132                 7.565753
....           .....            ....
1261   1095               0.035616

My goal is to plot a correlation matrix between the products_id regarding the average demand. (so where x is the correlation as in the table below)

so the get: 
          655       132   .....   1261
     655   1         x     x        x
     132   x         1     x        x  
    ....     
        .....       x     x         x
    1261    x       x     x         1

Can someone help me how to get a correlation matrix within a column of a dataframe?

Trenton McKinney
  • 56,955
  • 33
  • 144
  • 158
Rutger
  • 1
  • 2

1 Answers1

0

you can use corr in pandas like this :

df['product_id'].corr(df['averageDemand'])