The dataframe into which you have read csv file should contain the column 'quality'.
correlations = df.corr()['quality'].drop('quality')
Here we are trying to find correlations between column quality and all the other columns other than quality. 'quality' is our target variable.
I see you have value for 'quality' column in the dataset but it is not being read properly. As you can see in the output row 2 and 3 are showing .... but values are present in the actual dataset. Can you try printing df['quality'] and see are there are blank values for it?
I have a problem:
correlations = df.corr()['quality'].drop('quality')
Keyerror : 'quality'
Some idea?
Hey Eric,
Please pass the separator value while reading the CSV file.
ex:
df = pd.read_csv('winequality-red.csv', sep=";")
The dataframe into which you have read csv file should contain the column 'quality'.
correlations = df.corr()['quality'].drop('quality')
Here we are trying to find correlations between column quality and all the other columns other than quality. 'quality' is our target variable.
This my csv
I have this column named 'quality'.
This is my code:
And i am having the problem:
Help pls :,(
I see you have value for 'quality' column in the dataset but it is not being read properly. As you can see in the output row 2 and 3 are showing .... but values are present in the actual dataset. Can you try printing df['quality'] and see are there are blank values for it?
It is reading all the columns as one column. You need to pass the separator while reading the CSV file.
ex:
df = pd.read_csv('winequality-red.csv', sep=";")