Challenge

Project 2 : Analysis of Fermented Drink Data

All the questions are answered and all required files are attached at the end, here is just the brief and short answer for the question.

1.Display the data of white wine and red wine

2.Get the size of both white wine and red wine.

Ans.

------------- WHITE WINE -------------
Number of rows : 4898
Number of columns: 12
-------------- RED WINE --------------
Number of rows : 1599
Number of columns: 12
-----------------------------------------

3.Get the number of null in both type of wines

Ans.

------------- WHITE WINE -------------
fixed acidity 0
volatile acidity 0
citric acid 0
residual sugar 0
chlorides 0
free sulfur dioxide 0
total sulfur dioxide 0
density 0
pH 0
sulphates 0
alcohol 0
quality 0
dtype: int64
-------------- RED WINE --------------
fixed acidity 0
volatile acidity 0
citric acid 0
residual sugar 0
chlorides 0
free sulfur dioxide 0
total sulfur dioxide 0
density 0
pH 0
sulphates 0
alcohol 0
quality 0
dtype: int64

-----------------------------------------

4.Check for duplicates and remove them in both type of wine data

Ans.

------------- WHITE WINE -------------
No of rows duplicated: 937
Total no of rows: 4898
Total no of rows after removing duplicate rows: 3961
-------------- RED WINE --------------
No of rows duplicated: 240
Total no of rows: 1599
Total no of rows after removing duplicate rows: 1359
--------------------------------------

5.Get the number of uniques values in all Feature and print them

Ans.

------------- WHITE WINE -------------
No of Unique values in fixed acidity : 68
No of Unique values in volatile acidity : 125
No of Unique values in citric acid : 87
No of Unique values in residual sugar : 310
No of Unique values in chlorides : 160
No of Unique values in free sulfur dioxide : 132
No of Unique values in total sulfur dioxide : 251
No of Unique values in density : 890
No of Unique values in pH : 103
No of Unique values in sulphates : 79
No of Unique values in alcohol : 103
No of Unique values in quality : 7
-------------- RED WINE --------------
No of Unique values in fixed acidity : 96
No of Unique values in volatile acidity : 143
No of Unique values in citric acid : 80
No of Unique values in residual sugar : 91
No of Unique values in chlorides : 153
No of Unique values in free sulfur dioxide : 60
No of Unique values in total sulfur dioxide : 144
No of Unique values in density : 436
No of Unique values in pH : 89
No of Unique values in sulphates : 96
No of Unique values in alcohol : 65
No of Unique values in quality : 6
--------------------------------------

6.Print the mean density of both the sets

Ans.

Mean density of White wine : 0.9937895304216049
Mean density of Red wine : 0.9967089477557026

7.Combine both the datasets with color of the wine in column

8.Remove the null values if any

Ans.

fixed acidity 0
volatile acidity 0
citric acid 0
residual sugar 0
chlorides 0
free sulfur dioxide 0
total sulfur dioxide 0
density 0
pH 0
sulphates 0
alcohol 0
quality 0
color 0
dtype: int64

9.Remove the outliers if any

Ans.

Total no of rows: 5320
Total no of rows after removing outliers rows: 4869

10.Do wines with higher alcohol content receive better ratings?

Ans.

The correlation coefficient is positive, it means that as alcohol content increases, the quality rating tends to increase

11.Find correlation between citric acid content and PH.

Ans.

If the correlation coefficient between citric acid content and pH is negative, that indicates a negative correlation between the two variables. In other words, as the citric acid content increases, the pH tends to decrease.

12.Find regression of PH on citric acid

13.Find how many variables are independent.

Ans.

The number of independent variables is 2.

14.Create a new column as the acidity level. Divide the existing data into 5 groups based on the acidity level. The levels are to be named ['High', 'Moderately_High', 'Medium', 'Low']. Acidity may be obtained from the PH.

15.Find the mean quality of each acidity level with groupby. Use groupby

Ans.

acidity level
Very low 5.773263
Low 5.875632
Medium 5.894454
Moderately High 5.558140
High NaN
Name: quality, dtype: float64

16.Is a certain type of wine (red or white) associated with higher quality?

Ans.

0 = white , 1 =red
color
0 5.877875
1 5.649171
Name: quality, dtype: float64


From the output, you can see that the mean quality score for color 0 (white) is slightly higher than color 1 (red). However, the difference is very small and may not be statistically significant. Therefore, it's difficult to say that a certain type of color is associated with higher quality based on
this data alone.

17.Select samples with alcohol content less than the median

18.Get the quality rating for the low alcohol and high alcohol groups.

Ans.

The average quality rating for the low alcohol group is: 5.48
The average quality rating for the high alcohol group is: 6.19

19.Do sweeter wines get more ratings?

Ans.

The scatter plot show whether there is a trend between residual sugar and quality. If sweeter wines get more ratings, we would expect to see a positive correlation between residual sugar and quality but here almost the values are same

20.Get the number of counts based on ratings and color of wine.

Ans.

quality color
4 0 144
1 32
5 0 1111
1 474
6 0 1720
1 435
7 0 679
1 133
8 0 129
1 12
dtype: int64

21.Is the density of red wine and white wine similar?

Ans.

Yes the density of red wine and white wine is almost same

22.Is the confidence interval for the differences of the proportion of white wine with rating 3 and the proportion of red wine with rating 3.

Your portfolio, next

Ship work like this
in your own course.

Talk to a career counsellor

Free 20-minute call. We'll map the right course to where you want to work.

By submitting you agree to our Terms and Privacy Policy.