text_html_output_1.png
import matplotlib.pyplot as plt

import numpy as np # linear algebra

import pandas as pd # data processing, CSV file I/O (e.g. pd.read_csv)

import seaborn as sns

wine_data = pd.read_csv('../input/wine-reviews-data/wine.csv')
wine_data

wine_data.dtypes

wine_data.isnull().sum()

wine_data.isnull().sum()

wine_data = wine_data.assign(alcohol_num=lambda row: row['alcohol'].replace('%', '', regex=True).astype('float'))

wine_data1 = wine_data.dropna(subset=['price'])
price_nums = []
for index, row in wine_data1.iterrows():
    if row['price'].replace('$', '').isdecimal():
        price_nums.append(float(row['price'].replace('$', '')))
    else:
        price_nums.append(np.nan)
wine_data2 = wine_data1.copy()
wine_data2['price_num'] = price_nums
wine_data2 = wine_data2.dropna(subset=['price_num'])

Top_rated_wine = wine_data2.sort_values('rating', ascending=False).head(10)
Top_rated_wine

top_10_expensive_wine = wine_data2.sort_values('price', ascending=False).head(10)
top_10_expensive_wine

Top_10_cheapest_wine = wine_data2.sort_values('price', ascending=True).head(10)
Top_10_cheapest_wine

sns.pairplot(wine_data2)