Problems with Pandas corr() function

Viewed 22

Trying to get a correlation matrix in using pandas.DataFrame.corr() but for some reason it's only returning 1 column. enter image description here

1 Answers

I replicate your situation on my system google colab and it works perfectly.

version that i use:

python version: 3.7.14
pandas version: 1.3.5

My code:

import pandas as pd

df = pd.read_csv('/content/TEST.csv') # create dataset from your image that you 
                                      #post in your question and load it into data frame

print(df[['Unit 1 MC', 'Quizzes', 'Assignments']])

df[['Unit 1 MC', 'Quiz', 'Assig']].corr()
Related