text_html_output_1.png
import matplotlib.pyplot as plt

import pandas as pd

import seaborn as sns

import pandas as pd
pd.set_option('display.max_columns', None)
import numpy as np
import scipy.stats as stats
import matplotlib.pyplot as plt
import seaborn as sns
sns.set_style(style='darkgrid')
sns.set_palette(palette='pastel')
pd.options.display.max_colwidth = 300
cmap = sns.diverging_palette(220, 10, as_cmap=True)

data = pd.read_csv('/kaggle/input/red-wine-quality-cortez-et-al-2009/winequality-red.csv')

plt.figure(figsize=(15,6))
quality_count = data['quality'].value_counts().sort_values(ascending=False).to_frame()
quality_count = quality_count.rename(columns={'quality':'Count'})
ax = sns.barplot(x=quality_count.index, y='Count', data=quality_count, palette="ch:.25")
for p in ax.patches:
    ax.annotate(format(p.get_height(), '.1f'),
               (p.get_x() + p.get_width() / 2., p.get_height()),
               ha='center', va='center',
               xytext = (0,9),
               textcoords='offset points')
plt.xlabel("Quality", fontsize=15)
plt.ylabel("Count", fontsize=15)
plt.title("Bar plot of Quality", fontsize=20)
plt.show()

table_nan = data.isna().sum().to_frame().style.background_gradient(cmap=cmap)
table_nan

feature_desc = ['most acids involved with wine or fixed or nonvolatile (do not evaporate readily)', 'he amount of acetic acid in wine, which at too high of levels can lead to an unpleasant, vinegar taste', 'found in small quantities, citric acid can add freshness and flavor to wines', "the amount of sugar remaining after fermentation stops, it's rare to find wines with less than 1 gram/liter and wines with greater than 45 grams/liter are considered sweet", 'the amount of salt in the wine', 'the free form of SO2 exists in equilibrium between molecular SO2 (as a dissolved gas) and bisulfite ion; it prevents microbial growth and the oxidation of wine', 'amount of free and bound forms of S02; in low concentrations, SO2 is mostly undetectable in wine, but at free SO2 concentrations over 50 ppm, SO2 becomes evident in the nose and taste of wine', 'the density of water is close to that of water depending on the percent alcohol and sugar content', 'describes how acidic or basic a wine is on a scale from 0 (very acidic) to 14 (very basic); most wines are between 3-4 on the pH scale', 'a wine additive which can contribute to sulfur dioxide gas (S02) levels, wich acts as an antimicrobial and antioxidant', '-', 'score between 0 and 10']
feature_desc = pd.DataFrame(feature_desc, columns=['Description'], index=data.columns)

data_desc = data.describe().T
data_description = pd.concat([feature_desc, data_desc], axis=1)

f, ax = plt.subplots(3, 4, figsize=(25, 15))
sns.despine(left=True)
sns.boxplot(data['fixed acidity'], ax=ax[0, 0])
sns.boxplot(data['volatile acidity'], ax=ax[0, 1])
sns.boxplot(data['citric acid'], ax=ax[0, 2])
sns.boxplot(data['residual sugar'], ax=ax[0, 3])
sns.boxplot(data['chlorides'], ax=ax[1, 0])
sns.boxplot(data['density'], ax=ax[1, 1])
sns.boxplot(data['pH'], ax=ax[1, 2])
sns.boxplot(data['sulphates'], ax=ax[1, 3])
sns.boxplot(data['alcohol'], ax=ax[2, 0])
sns.boxplot(data['total sulfur dioxide'], ax=ax[2, 1])
sns.boxplot(data['free sulfur dioxide'], ax=ax[2, 2])
sns.boxplot(data['quality'], ax=ax[2, 3])
plt.show()