In [25]:
import pandas as pd
import matplotlib.pyplot as plt
import numpy as np
from pandas import Series,DataFrame
import seaborn as sns
In [26]:
input_data = pd.read_csv("winemag-data_first150k.csv")
In [27]:
input_data.head()
Out[27]:
Unnamed: 0
country
description
designation
points
price
province
region_1
region_2
variety
winery
0
0
US
This tremendous 100% varietal wine hails from ...
Martha's Vineyard
96
235.0
California
Napa Valley
Napa
Cabernet Sauvignon
Heitz
1
1
Spain
Ripe aromas of fig, blackberry and cassis are ...
Carodorum Selección Especial Reserva
96
110.0
Northern Spain
Toro
NaN
Tinta de Toro
Bodega Carmen Rodríguez
2
2
US
Mac Watson honors the memory of a wine once ma...
Special Selected Late Harvest
96
90.0
California
Knights Valley
Sonoma
Sauvignon Blanc
Macauley
3
3
US
This spent 20 months in 30% new French oak, an...
Reserve
96
65.0
Oregon
Willamette Valley
Willamette Valley
Pinot Noir
Ponzi
4
4
France
This is the top wine from La Bégude, named aft...
La Brûlade
95
66.0
Provence
Bandol
NaN
Provence red blend
Domaine de la Bégude
In [28]:
input_data.groupby(["country"])["points","price"].sum()
Out[28]:
points
price
country
Albania
176
40.0
Argentina
484244
116181.0
Australia
435683
152979.0
Austria
272919
77450.0
Bosnia and Herzegovina
339
51.0
Brazil
2081
498.0
Bulgaria
6581
889.0
Canada
17295
6718.0
Chile
501902
111542.0
China
246
61.0
Croatia
7679
1918.0
Cyprus
2662
480.0
Czech Republic
515
108.0
Egypt
251
NaN
England
836
380.0
France
1876158
674490.0
Georgia
3677
799.0
Germany
217312
91559.0
Greece
76128
18964.0
Hungary
20173
10167.0
India
701
111.0
Israel
54921
19096.0
Italy
2075776
705300.0
Japan
170
48.0
Lebanon
3171
941.0
Lithuania
674
80.0
Luxembourg
783
366.0
Macedonia
1357
245.0
Mexico
5340
1833.0
Moldova
6015
1091.0
Montenegro
164
20.0
Morocco
1058
226.0
New Zealand
290680
74212.0
Portugal
468643
109965.0
Romania
11804
2279.0
Serbia
1228
340.0
Slovakia
251
46.0
Slovenia
8294
2273.0
South Africa
196955
47269.0
South Korea
326
54.0
Spain
716394
220716.0
Switzerland
349
106.0
Tunisia
172
NaN
Turkey
4581
1290.0
US
5479629
2091214.0
US-France
88
50.0
Ukraine
423
65.0
Uruguay
7772
2197.0
In [30]:
input_data.groupby(["country"])["points"].min()
Out[30]:
country
Albania 88
Argentina 80
Australia 80
Austria 81
Bosnia and Herzegovina 83
Brazil 81
Bulgaria 80
Canada 82
Chile 80
China 82
Croatia 81
Cyprus 80
Czech Republic 85
Egypt 83
England 91
France 80
Georgia 81
Germany 80
Greece 80
Hungary 80
India 82
Israel 80
Italy 80
Japan 85
Lebanon 81
Lithuania 84
Luxembourg 86
Macedonia 81
Mexico 80
Moldova 81
Montenegro 82
Morocco 82
New Zealand 80
Portugal 80
Romania 80
Serbia 86
Slovakia 82
Slovenia 82
South Africa 80
South Korea 81
Spain 80
Switzerland 83
Tunisia 85
Turkey 84
US 80
US-France 88
Ukraine 83
Uruguay 80
Name: points, dtype: int64
In [61]:
input_data.groupby(["country","province"])["points"].min()
Out[61]:
country province
Albania Mirditë 88
Argentina Mendoza Province 80
Other 80
Australia Australia Other 80
New South Wales 81
Queensland 85
South Australia 80
Tasmania 83
Victoria 80
Western Australia 80
Austria Austria 83
Burgenland 81
Carnuntum 83
Donauland 84
Eisenberg 90
Kamptal 85
Kremstal 84
Langenlois 84
Leithaberg 89
Mittelburgenland 82
Neusiedlersee 82
Neusiedlersee-Hügelland 84
Niederösterreich 82
South Styria 86
Steiermark 86
Styria 85
Südoststeiermark 85
Südsteiermark 82
Thermenregion 84
Traisental 89
..
US Idaho 80
Iowa 83
Kentucky 81
Massachusetts 83
Michigan 81
Missouri 80
Nevada 84
New Jersey 80
New Mexico 81
New York 80
North Carolina 81
Ohio 80
Oregon 80
Pennsylvania 80
Texas 82
Vermont 84
Virginia 80
Washington 80
Washington-Oregon 84
US-France Santa Barbara County-Condrieu 88
Ukraine Ukraine 83
Uruguay Atlantida 81
Canelones 80
Colonia 82
El Colorado 86
Juanico 81
Montevideo 89
Progreso 88
San Jose 82
Uruguay 80
Name: points, Length: 455, dtype: int64
In [31]:
input_data.head()
Out[31]:
Unnamed: 0
country
description
designation
points
price
province
region_1
region_2
variety
winery
0
0
US
This tremendous 100% varietal wine hails from ...
Martha's Vineyard
96
235.0
California
Napa Valley
Napa
Cabernet Sauvignon
Heitz
1
1
Spain
Ripe aromas of fig, blackberry and cassis are ...
Carodorum Selección Especial Reserva
96
110.0
Northern Spain
Toro
NaN
Tinta de Toro
Bodega Carmen Rodríguez
2
2
US
Mac Watson honors the memory of a wine once ma...
Special Selected Late Harvest
96
90.0
California
Knights Valley
Sonoma
Sauvignon Blanc
Macauley
3
3
US
This spent 20 months in 30% new French oak, an...
Reserve
96
65.0
Oregon
Willamette Valley
Willamette Valley
Pinot Noir
Ponzi
4
4
France
This is the top wine from La Bégude, named aft...
La Brûlade
95
66.0
Provence
Bandol
NaN
Provence red blend
Domaine de la Bégude
In [32]:
input_data.groupby(["country"])["points","price"].apply(lambda df: df.loc[df.points.argmax()])
Out[32]:
points
price
country
Albania
88.0
20.0
Argentina
97.0
120.0
Australia
100.0
300.0
Austria
98.0
103.0
Bosnia and Herzegovina
88.0
12.0
Brazil
88.0
15.0
Bulgaria
90.0
15.0
Canada
93.0
45.0
Chile
95.0
90.0
China
82.0
27.0
Croatia
91.0
50.0
Cyprus
89.0
18.0
Czech Republic
87.0
15.0
Egypt
84.0
NaN
England
94.0
45.0
France
100.0
848.0
Georgia
92.0
25.0
Germany
97.0
245.0
Greece
92.0
23.0
Hungary
96.0
125.0
India
91.0
12.0
Israel
93.0
40.0
Italy
100.0
460.0
Japan
85.0
24.0
Lebanon
91.0
20.0
Lithuania
85.0
10.0
Luxembourg
88.0
50.0
Macedonia
89.0
20.0
Mexico
92.0
54.0
Moldova
90.0
32.0
Montenegro
82.0
10.0
Morocco
93.0
35.0
New Zealand
94.0
57.0
Portugal
99.0
426.0
Romania
92.0
28.0
Serbia
89.0
20.0
Slovakia
87.0
16.0
Slovenia
92.0
50.0
South Africa
95.0
130.0
South Korea
82.0
16.0
Spain
98.0
450.0
Switzerland
90.0
28.0
Tunisia
87.0
NaN
Turkey
92.0
33.0
US
100.0
65.0
US-France
88.0
50.0
Ukraine
86.0
13.0
Uruguay
90.0
45.0
In [33]:
input_data.groupby(["country"])["points"].max()
Out[33]:
country
Albania 88
Argentina 97
Australia 100
Austria 98
Bosnia and Herzegovina 88
Brazil 88
Bulgaria 90
Canada 93
Chile 95
China 82
Croatia 91
Cyprus 89
Czech Republic 87
Egypt 84
England 94
France 100
Georgia 92
Germany 97
Greece 92
Hungary 96
India 91
Israel 93
Italy 100
Japan 85
Lebanon 91
Lithuania 85
Luxembourg 88
Macedonia 89
Mexico 92
Moldova 90
Montenegro 82
Morocco 93
New Zealand 94
Portugal 99
Romania 92
Serbia 89
Slovakia 87
Slovenia 92
South Africa 95
South Korea 82
Spain 98
Switzerland 90
Tunisia 87
Turkey 92
US 100
US-France 88
Ukraine 86
Uruguay 90
Name: points, dtype: int64
In [34]:
input_data.groupby(["country"])["points"].agg([len, min, max])
Out[34]:
len
min
max
country
Albania
2
88
88
Argentina
5631
80
97
Australia
4957
80
100
Austria
3057
81
98
Bosnia and Herzegovina
4
83
88
Brazil
25
81
88
Bulgaria
77
80
90
Canada
196
82
93
Chile
5816
80
95
China
3
82
82
Croatia
89
81
91
Cyprus
31
80
89
Czech Republic
6
85
87
Egypt
3
83
84
England
9
91
94
France
21098
80
100
Georgia
43
81
92
Germany
2452
80
97
Greece
884
80
92
Hungary
231
80
96
India
8
82
91
Israel
630
80
93
Italy
23478
80
100
Japan
2
85
85
Lebanon
37
81
91
Lithuania
8
84
85
Luxembourg
9
86
88
Macedonia
16
81
89
Mexico
63
80
92
Moldova
71
81
90
Montenegro
2
82
82
Morocco
12
82
93
New Zealand
3320
80
94
Portugal
5322
80
99
Romania
139
80
92
Serbia
14
86
89
Slovakia
3
82
87
Slovenia
94
82
92
South Africa
2258
80
95
South Korea
4
81
82
Spain
8268
80
98
Switzerland
4
83
90
Tunisia
2
85
87
Turkey
52
84
92
US
62397
80
100
US-France
1
88
88
Ukraine
5
83
86
Uruguay
92
80
90
In [37]:
input_data.loc[input_data["country"] =="Albania"]
Out[37]:
Unnamed: 0
country
description
designation
points
price
province
region_1
region_2
variety
winery
4642
4642
Albania
This garnet-colored wine made from 100% Kallme...
NaN
88
20.0
Mirditë
NaN
NaN
Kallmet
Arbëri
4864
4864
Albania
This garnet-colored wine made from 100% Kallme...
NaN
88
20.0
Mirditë
NaN
NaN
Kallmet
Arbëri
In [52]:
input_data.loc[input_data["country"] =="Slovakia"]
Out[52]:
Unnamed: 0
country
description
designation
points
price
province
region_1
region_2
variety
winery
70992
70992
Slovakia
Slovakian winemaker Miroslav Petrech and Germa...
NaN
82
15.0
Muzla
NaN
NaN
Riesling
Château Bela
87878
87878
Slovakia
Delicious scents of honey, apples and petrol l...
NaN
87
16.0
Muzla
NaN
NaN
Riesling
Château Bela
143322
143322
Slovakia
Slovakian winemaker Miroslav Petrech and Germa...
NaN
82
15.0
Muzla
NaN
NaN
Riesling
Château Bela
In [58]:
#重复为True,不重复为False
input_data.duplicated(subset=["description","points","price","country","province","variety"], keep='first').value_counts()
Out[58]:
False 97843
True 53087
dtype: int64
In [55]:
input_data.duplicated().value_counts()
out_data = input_data.drop_duplicates(subset=["description","points","price","country","province","variety"],keep='last',inplace=False)
In [56]:
out_data.duplicated(subset=["description","points","price","country","province","variety"], keep='first').value_counts()
Out[56]:
False 97843
dtype: int64
In [59]:
out_data.describe()
Out[59]:
Unnamed: 0
points
price
count
97843.000000
97843.000000
89127.000000
mean
82343.749333
87.956573
33.659250
std
46739.581663
3.218062
37.670933
min
0.000000
80.000000
4.000000
25%
38411.500000
86.000000
16.000000
50%
85885.000000
88.000000
25.000000
75%
126458.500000
90.000000
40.000000
max
150929.000000
100.000000
2300.000000
In [42]:
input_data.describe()
Out[42]:
Unnamed: 0
points
price
count
150930.000000
150930.000000
137235.000000
mean
75464.500000
87.888418
33.131482
std
43569.882402
3.222392
36.322536
min
0.000000
80.000000
4.000000
25%
37732.250000
86.000000
16.000000
50%
75464.500000
88.000000
24.000000
75%
113196.750000
90.000000
40.000000
max
150929.000000
100.000000
2300.000000
In [ ]:
In [22]:
input_data.sort_values("points",ascending = False)
Out[22]:
Unnamed: 0
country
description
designation
points
price
province
region_1
region_2
variety
winery
137099
137099
US
Tasted in a flight of great and famous Napa wi...
NaN
100
200.0
California
Napa Valley
Napa
Cabernet Sauvignon
Cardinale
19354
19354
US
In a stunning lineup of Cayuse Syrahs, the En ...
En Chamberlin Vineyard
100
65.0
Oregon
Walla Walla Valley (OR)
Oregon Other
Syrah
Cayuse
84035
84035
Australia
Not a Cellar Selection in the traditional sens...
Rare
100
300.0
Victoria
Rutherglen
NaN
Muscat
Chambers Rosewood Vineyards
84034
84034
US
In a stunning lineup of Cayuse Syrahs, the En ...
En Chamberlin Vineyard
100
65.0
Oregon
Walla Walla Valley (OR)
Oregon Other
Syrah
Cayuse
122767
122767
US
A spectacular Pinot Noir, but a very young one...
Litton Estate Vineyard
100
100.0
California
Russian River Valley
Sonoma
Pinot Noir
Williams Selyem
2145
2145
France
Full of ripe fruit, opulent and concentrated, ...
NaN
100
848.0
Bordeaux
Pessac-Léognan
NaN
Bordeaux-style White Blend
Château Haut-Brion
83536
83536
France
A wine that has created its own universe. It h...
Clos du Mesnil
100
1400.0
Champagne
Champagne
NaN
Chardonnay
Krug
26296
26296
France
A wine that has created its own universe. It h...
Clos du Mesnil
100
1400.0
Champagne
Champagne
NaN
Chardonnay
Krug
89399
89399
US
Tasted in a flight of great and famous Napa wi...
NaN
100
200.0
California
Napa Valley
Napa
Cabernet Sauvignon
Cardinale
24151
24151
Italy
A perfect wine from a classic vintage, the 200...
Masseto
100
460.0
Tuscany
Toscana
NaN
Merlot
Tenuta dell'Ornellaia
138867
138867
Italy
Thick as molasses and dark as caramelized brow...
Occhio di Pernice
100
210.0
Tuscany
Vin Santo di Montepulciano
NaN
Prugnolo Gentile
Avignonesi
41521
41521
Italy
A perfect wine from a classic vintage, the 200...
Masseto
100
460.0
Tuscany
Toscana
NaN
Merlot
Tenuta dell'Ornellaia
28954
28954
Italy
This small, family-run estate in the heart of ...
Guado de' Gemoli
100
195.0
Tuscany
Bolgheri Superiore
NaN
Red Blend
Giovanni Chiappini
119195
119195
Australia
Not a Cellar Selection in the traditional sens...
Rare
100
300.0
Victoria
Rutherglen
NaN
Muscat
Chambers Rosewood Vineyards
119194
119194
US
In a stunning lineup of Cayuse Syrahs, the En ...
En Chamberlin Vineyard
100
65.0
Oregon
Walla Walla Valley (OR)
Oregon Other
Syrah
Cayuse
92916
92916
US
A perfect score has to be considered in the co...
Hillside Select
100
215.0
California
Stags Leap District
Napa
Cabernet Sauvignon
Shafer
119521
119521
Italy
A perfect wine from a classic vintage, the 200...
Masseto
100
460.0
Tuscany
Toscana
NaN
Merlot
Tenuta dell'Ornellaia
19355
19355
Australia
Not a Cellar Selection in the traditional sens...
Rare
100
300.0
Victoria
Rutherglen
NaN
Muscat
Chambers Rosewood Vineyards
51886
51886
France
A wine that has created its own universe. It h...
Clos du Mesnil
100
1400.0
Champagne
Champagne
NaN
Chardonnay
Krug
78004
78004
Italy
This small, family-run estate in the heart of ...
Guado de' Gemoli
100
195.0
Tuscany
Bolgheri Superiore
NaN
Red Blend
Giovanni Chiappini
98647
98647
US
A spectacular Pinot Noir, but a very young one...
Litton Estate Vineyard
100
100.0
California
Russian River Valley
Sonoma
Pinot Noir
Williams Selyem
111087
111087
Italy
Thick as molasses and dark as caramelized brow...
Occhio di Pernice
100
210.0
Tuscany
Vin Santo di Montepulciano
NaN
Prugnolo Gentile
Avignonesi
114272
114272
US
Impossibly aromatic. Hard to imagine greater c...
Red Wine
100
245.0
California
Rutherford
Napa
Cabernet Blend
Sloan
143522
143522
US
Impossibly aromatic. Hard to imagine greater c...
Red Wine
100
245.0
California
Rutherford
Napa
Cabernet Blend
Sloan
26297
26297
France
A magnificent Champagne, one that is light, de...
Dom Pérignon Oenothèque Brut
99
385.0
Champagne
Champagne
NaN
Champagne Blend
Moët & Chandon
90439
90439
US
There are incredible aromatics on this Caberne...
Elevation 1147 Estate
99
150.0
California
Napa Valley
Napa
Cabernet Sauvignon
David Arthur
90438
90438
US
This is an absolutely beautiful wine to drink ...
IX Estate
99
290.0
California
Napa Valley
Napa
Red Blend
Colgin
114273
114273
US
The aroma is deep and inviting, equal parts ne...
NaN
99
245.0
California
Napa Valley
Napa
Cabernet Blend
Harlan Estate
2146
2146
Italy
Perfumed berry, rose, new leather and dark spi...
Madonna delle Grazie
99
200.0
Tuscany
Brunello di Montalcino
NaN
Sangiovese
Il Marroneto
121305
121305
Italy
This sweet wine from Italy is guaranteed to bl...
Occhio di Pernice
99
237.0
Tuscany
Vin Santo di Montepulciano
NaN
Prugnolo Gentile
Avignonesi
...
...
...
...
...
...
...
...
...
...
...
...
84764
84764
US
This is tannic and tastes artificially sweet, ...
NaN
80
9.0
California
California
California Other
Red Blend
Kumbaya
84763
84763
US
This tastes soft, sweet and simple. The blend ...
NaN
80
10.0
California
California
California Other
White Blend
Immersion
84762
84762
Argentina
This is dark, amorphous and shows almost nothi...
NaN
80
15.0
Mendoza Province
Mendoza
NaN
Pinot Noir
Bodega Carmine Granata
84761
84761
US
This has medicinal, sweet-tasting flavors of c...
NaN
80
10.0
California
California
California Other
Merlot
Fat Cat
84760
84760
Spain
This is lean, crisp, acidic and downright shri...
NaN
80
10.0
Northern Spain
Rioja
NaN
Tempranillo
Casa de la Reina
114270
114270
US
Dry, tannic and acidic to the point of mouth-p...
Barrel Select
80
15.0
California
Sierra Foothills
Sierra Foothills
Syrah
Amador Foothill Winery
114271
114271
Greece
The nose opens with a hint of oak that leads t...
White
80
9.0
Patras
NaN
NaN
Roditis
Kouros
84759
84759
US
This is just barely drinkable, with modest bla...
NaN
80
36.0
California
York Mountain
Central Coast
Cabernet Sauvignon
Calcareous
84758
84758
France
This very ripe wine tastes of supermature grap...
NaN
80
20.0
Bordeaux
Bordeaux Supérieur
NaN
Bordeaux-style Red Blend
Château Timberlay
84757
84757
France
Lean and rather dry, this has old wood and lea...
Hyppos
80
25.0
Bordeaux
Bordeaux Supérieur
NaN
Bordeaux-style Red Blend
Château Majoureau
55225
55225
US
As sugary sweet as cherry and raspberry pie fi...
Mr. Beast
80
19.0
California
Dry Creek Valley
Sonoma
Zinfandel
Barber
55223
55223
Spain
Red licorice candy on the nose is the only sig...
Gran Reserva
80
15.0
Central Spain
La Mancha
NaN
Tempranillo Blend
Gran Oristan
26660
26660
Portugal
A curious sauerkraut perfume leads to a hard e...
NaN
80
NaN
Lisboa
NaN
NaN
Touriga Nacional
Quinta do Pinto
103992
103992
Chile
Heavy as dead weight, with a raisiny nose. Onl...
Family Selection
80
14.0
Colchagua Valley
NaN
NaN
Malbec
Luis Felipe Edwards
26661
26661
Spain
Strained from front to back. The nose smells p...
Sweet Chardonnay-Moscato
80
10.0
Spain Other
Spain
NaN
White Blend
Torito Bravo
141754
141754
US
Softly tannic and far too sweet for a dry tabl...
Diamond Reserve Aria
80
38.0
California
Paso Robles
Central Coast
Cabernet Blend
Harmony Cellars
36442
36442
US
A barrel fermented Chardonnay that is uncharac...
NaN
80
10.0
California
Lodi
Central Valley
Chardonnay
Campus Oaks
36443
36443
Spain
Sweet melon and peach aromas are candied. In t...
234
80
17.0
Northern Spain
Somontano
NaN
Chardonnay
Enate
36444
36444
Spain
The cold, rainy conditions of 2008 must have a...
Reserva
80
40.0
Northern Spain
Rioja
NaN
Tempranillo Blend
Finca Valpiedra
103988
103988
US
The official alcohol is under 14%, but the win...
Tombs Creek Vineyard
80
29.0
California
Sonoma County
Sonoma
Cabernet Sauvignon
Tin Barn
103989
103989
US
Vegetal and dry, this Rhône-style blend of Syr...
The Gem
80
16.0
California
Paso Robles
Central Coast
Rhône-style Red Blend
Stacked Stone
42382
42382
US
A mix of disjointed impressions. Some floral n...
NaN
80
12.0
Oregon
Willamette Valley
Willamette Valley
Pinot Gris
Château Bianca
42381
42381
Uruguay
Not very lively or fruity. Vague aromas and fl...
Identity Tannat
80
15.0
Canelones
NaN
NaN
Rosé
Gimenez Mendez
42380
42380
US
Too sweet in sugary blackberry jam to earn a h...
Estate Grown
80
20.0
California
Clear Lake
Mendocino/Lake Counties
Barbera
Rosa d'Oro
42379
42379
US
After the sulfur smell blows off, this wine re...
NaN
80
18.0
California
Lake County
Mendocino/Lake Counties
Dolcetto
Rosa d'Oro
42378
42378
US
So vegetal, it's barely drinkable. Cabernets S...
Hawk Red
80
14.0
California
Santa Ynez Valley
Central Coast
Red Blend
Buttonwood Farm
42377
42377
US
A blend of five diverse red grapes, this light...
Cascade Terrace Red
80
17.0
Oregon
Rogue Valley
Southern Oregon
Red Blend
Agate Ridge
103990
103990
US
The age of this wine, nearly 5 years, makes yo...
NaN
80
25.0
California
Dry Creek Valley
Sonoma
Merlot
Hawley
103991
103991
US
It's been an uphill battle for Pietra Santa wi...
NaN
80
18.0
California
Cienega Valley
Central Coast
Dolcetto
Pietra Santa
141755
141755
US
The only thing that's not Porty about this win...
Select Reserve
80
30.0
California
Temecula
South Coast
Zinfandel
Stuart Cellars
150930 rows × 11 columns
In [24]:
input_data.sort_values(by = ["points","price"],ascending = False)
Out[24]:
Unnamed: 0
country
description
designation
points
price
province
region_1
region_2
variety
winery
26296
26296
France
A wine that has created its own universe. It h...
Clos du Mesnil
100
1400.0
Champagne
Champagne
NaN
Chardonnay
Krug
51886
51886
France
A wine that has created its own universe. It h...
Clos du Mesnil
100
1400.0
Champagne
Champagne
NaN
Chardonnay
Krug
83536
83536
France
A wine that has created its own universe. It h...
Clos du Mesnil
100
1400.0
Champagne
Champagne
NaN
Chardonnay
Krug
2145
2145
France
Full of ripe fruit, opulent and concentrated, ...
NaN
100
848.0
Bordeaux
Pessac-Léognan
NaN
Bordeaux-style White Blend
Château Haut-Brion
24151
24151
Italy
A perfect wine from a classic vintage, the 200...
Masseto
100
460.0
Tuscany
Toscana
NaN
Merlot
Tenuta dell'Ornellaia
41521
41521
Italy
A perfect wine from a classic vintage, the 200...
Masseto
100
460.0
Tuscany
Toscana
NaN
Merlot
Tenuta dell'Ornellaia
119521
119521
Italy
A perfect wine from a classic vintage, the 200...
Masseto
100
460.0
Tuscany
Toscana
NaN
Merlot
Tenuta dell'Ornellaia
19355
19355
Australia
Not a Cellar Selection in the traditional sens...
Rare
100
300.0
Victoria
Rutherglen
NaN
Muscat
Chambers Rosewood Vineyards
84035
84035
Australia
Not a Cellar Selection in the traditional sens...
Rare
100
300.0
Victoria
Rutherglen
NaN
Muscat
Chambers Rosewood Vineyards
119195
119195
Australia
Not a Cellar Selection in the traditional sens...
Rare
100
300.0
Victoria
Rutherglen
NaN
Muscat
Chambers Rosewood Vineyards
114272
114272
US
Impossibly aromatic. Hard to imagine greater c...
Red Wine
100
245.0
California
Rutherford
Napa
Cabernet Blend
Sloan
143522
143522
US
Impossibly aromatic. Hard to imagine greater c...
Red Wine
100
245.0
California
Rutherford
Napa
Cabernet Blend
Sloan
92916
92916
US
A perfect score has to be considered in the co...
Hillside Select
100
215.0
California
Stags Leap District
Napa
Cabernet Sauvignon
Shafer
111087
111087
Italy
Thick as molasses and dark as caramelized brow...
Occhio di Pernice
100
210.0
Tuscany
Vin Santo di Montepulciano
NaN
Prugnolo Gentile
Avignonesi
138867
138867
Italy
Thick as molasses and dark as caramelized brow...
Occhio di Pernice
100
210.0
Tuscany
Vin Santo di Montepulciano
NaN
Prugnolo Gentile
Avignonesi
89399
89399
US
Tasted in a flight of great and famous Napa wi...
NaN
100
200.0
California
Napa Valley
Napa
Cabernet Sauvignon
Cardinale
137099
137099
US
Tasted in a flight of great and famous Napa wi...
NaN
100
200.0
California
Napa Valley
Napa
Cabernet Sauvignon
Cardinale
28954
28954
Italy
This small, family-run estate in the heart of ...
Guado de' Gemoli
100
195.0
Tuscany
Bolgheri Superiore
NaN
Red Blend
Giovanni Chiappini
78004
78004
Italy
This small, family-run estate in the heart of ...
Guado de' Gemoli
100
195.0
Tuscany
Bolgheri Superiore
NaN
Red Blend
Giovanni Chiappini
98647
98647
US
A spectacular Pinot Noir, but a very young one...
Litton Estate Vineyard
100
100.0
California
Russian River Valley
Sonoma
Pinot Noir
Williams Selyem
122767
122767
US
A spectacular Pinot Noir, but a very young one...
Litton Estate Vineyard
100
100.0
California
Russian River Valley
Sonoma
Pinot Noir
Williams Selyem
19354
19354
US
In a stunning lineup of Cayuse Syrahs, the En ...
En Chamberlin Vineyard
100
65.0
Oregon
Walla Walla Valley (OR)
Oregon Other
Syrah
Cayuse
84034
84034
US
In a stunning lineup of Cayuse Syrahs, the En ...
En Chamberlin Vineyard
100
65.0
Oregon
Walla Walla Valley (OR)
Oregon Other
Syrah
Cayuse
119194
119194
US
In a stunning lineup of Cayuse Syrahs, the En ...
En Chamberlin Vineyard
100
65.0
Oregon
Walla Walla Valley (OR)
Oregon Other
Syrah
Cayuse
34920
34920
France
A big, powerful wine that sums up the richness...
NaN
99
2300.0
Bordeaux
Pauillac
NaN
Bordeaux-style Red Blend
Château Latour
68237
68237
France
Dense and rich but also incredibly complex, lo...
La Landonne
99
450.0
Rhône Valley
Côte Rôtie
NaN
Syrah
E. Guigal
113027
113027
France
Dense and rich but also incredibly complex, lo...
La Landonne
99
450.0
Rhône Valley
Côte Rôtie
NaN
Syrah
E. Guigal
135707
135707
France
Dense and rich but also incredibly complex, lo...
La Landonne
99
450.0
Rhône Valley
Côte Rôtie
NaN
Syrah
E. Guigal
81686
81686
Italy
This is an elegant Nebbiolo-based wine and arg...
Sorì Tildìn
99
440.0
Piedmont
Langhe
NaN
Nebbiolo
Gaja
81687
81687
Italy
Always a standout among Gaja's five single-vin...
Sorì San Lorenzo
99
440.0
Piedmont
Langhe
NaN
Nebbiolo
Gaja
...
...
...
...
...
...
...
...
...
...
...
...
68229
68229
Argentina
Flat and soupy, as if the life had been draine...
Antigua Cava
80
6.0
Mendoza Province
Mendoza
NaN
Cabernet Sauvignon
Bodega Familia Barberis
98644
98644
Chile
Neutral aromas, sour apple and citrus flavors,...
NaN
80
6.0
Curicó Valley
NaN
NaN
Chardonnay
Quasar
113019
113019
Argentina
Flat and soupy, as if the life had been draine...
Antigua Cava
80
6.0
Mendoza Province
Mendoza
NaN
Cabernet Sauvignon
Bodega Familia Barberis
115016
115016
France
Light in body and flavor, this southern France...
NaN
80
6.0
Languedoc-Roussillon
Vin de Pays d'Oc
NaN
Cabernet Sauvignon
Vignobles de France
117821
117821
Argentina
Almost transparent in color, with leafy, light...
Antigua Cava
80
6.0
Mendoza Province
Mendoza
NaN
Merlot
Bodega Familia Barberis
122764
122764
Chile
Neutral aromas, sour apple and citrus flavors,...
NaN
80
6.0
Curicó Valley
NaN
NaN
Chardonnay
Quasar
135221
135221
Argentina
Almost transparent in color, with leafy, light...
Antigua Cava
80
6.0
Mendoza Province
Mendoza
NaN
Merlot
Bodega Familia Barberis
135699
135699
Argentina
Flat and soupy, as if the life had been draine...
Antigua Cava
80
6.0
Mendoza Province
Mendoza
NaN
Cabernet Sauvignon
Bodega Familia Barberis
141924
141924
Argentina
Rubbery and jammy, with condensed aromas of co...
NaN
80
6.0
Mendoza Province
Mendoza
NaN
Cabernet Sauvignon
Funky Llama
143677
143677
Chile
Weedy, with cinnamon and sweet aromas. Very so...
NaN
80
6.0
Aconcagua Valley
NaN
NaN
Syrah
Conde de Velázquez
148526
148526
France
Light in body and flavor, this southern France...
NaN
80
6.0
Languedoc-Roussillon
Vin de Pays d'Oc
NaN
Cabernet Sauvignon
Vignobles de France
149169
149169
Argentina
Transparent in color, with bubblegum and candi...
NaN
80
6.0
Mendoza Province
Mendoza
NaN
Tempranillo
Funky Llama
7794
7794
Argentina
Candied plum and red berry aromas smell like r...
Estate Bottled
80
5.0
Mendoza Province
Mendoza
NaN
Malbec
Terrenal
36356
36356
Argentina
While this smells floral and candied, the pala...
NaN
80
5.0
Mendoza Province
Mendoza
NaN
Malbec
Toca Diamonte
103916
103916
Argentina
While this smells floral and candied, the pala...
NaN
80
5.0
Mendoza Province
Mendoza
NaN
Malbec
Toca Diamonte
26660
26660
Portugal
A curious sauerkraut perfume leads to a hard e...
NaN
80
NaN
Lisboa
NaN
NaN
Touriga Nacional
Quinta do Pinto
47434
47434
Italy
Le Balze is mostly Sangiovese, with small comp...
Le Balze
80
NaN
Tuscany
Rosso di Toscana
NaN
Red Blend
Castel Vecchio
60772
60772
Spain
A sweet, clumsy wine with gumball aromas in fr...
NaN
80
NaN
Northern Spain
Ribera del Duero
NaN
Tempranillo
Viña Gormaz
66535
66535
New Zealand
Simple and sweet-smelling, like butterscotch L...
Reserve
80
NaN
Marlborough
NaN
NaN
Chardonnay
Omaka Springs
87144
87144
France
A wine that has both tight tannins and an unpl...
NaN
80
NaN
Beaujolais
Beaujolais-Villages
NaN
Gamay
Château de Lavernette
108671
108671
Portugal
This Sauvignon Blanc has some herbal character...
Reserva dos Amigos
80
NaN
Estremadura
NaN
NaN
Sauvignon Blanc
Vidigal
108678
108678
Portugal
green wine, the Cabernet that dominates is ob...
Reserva dos Amigos
80
NaN
Estremadura
NaN
NaN
Cabernet Sauvignon
Vidigal
108681
108681
Portugal
The least interesting wine in the normally exc...
EA Tinto
80
NaN
Alentejano
NaN
NaN
Portuguese Red
Cartuxa
117812
117812
US
About as rustic as wines get while still drink...
Eclectic Red Wine
80
NaN
California
Paso Robles
Central Coast
Red Blend
Four Vines
135137
135137
US
Thin and lean, with moderate flavors of red be...
Proprietors Reserve
80
NaN
New York
North Fork of Long Island
Long Island
Cabernet Sauvignon
Palmer
135212
135212
US
About as rustic as wines get while still drink...
Eclectic Red Wine
80
NaN
California
Paso Robles
Central Coast
Red Blend
Four Vines
137020
137020
Portugal
Slapping “wine made from organic grapes“ on th...
Vintage
80
NaN
Douro
NaN
NaN
Port
Casal dos Jordões
141915
141915
Argentina
Piercing aromas of bulky fruit and horseradish...
Estate Bottled
80
NaN
Mendoza Province
Maipú
NaN
Merlot
Pascual Toso
142696
142696
France
This wine is certainly fresh, but it has an ar...
Le Bosc
80
NaN
Languedoc-Roussillon
Vin de Pays d'Oc
NaN
Chardonnay-Sauvignon
Pierre Besinet
150055
150055
New Zealand
Simple and sweet-smelling, like butterscotch L...
Reserve
80
NaN
Marlborough
NaN
NaN
Chardonnay
Omaka Springs
150930 rows × 11 columns
In [62]:
input_data.head()
Out[62]:
Unnamed: 0
country
description
designation
points
price
province
region_1
region_2
variety
winery
0
0
US
This tremendous 100% varietal wine hails from ...
Martha's Vineyard
96
235.0
California
Napa Valley
Napa
Cabernet Sauvignon
Heitz
1
1
Spain
Ripe aromas of fig, blackberry and cassis are ...
Carodorum Selección Especial Reserva
96
110.0
Northern Spain
Toro
NaN
Tinta de Toro
Bodega Carmen Rodríguez
2
2
US
Mac Watson honors the memory of a wine once ma...
Special Selected Late Harvest
96
90.0
California
Knights Valley
Sonoma
Sauvignon Blanc
Macauley
3
3
US
This spent 20 months in 30% new French oak, an...
Reserve
96
65.0
Oregon
Willamette Valley
Willamette Valley
Pinot Noir
Ponzi
4
4
France
This is the top wine from La Bégude, named aft...
La Brûlade
95
66.0
Provence
Bandol
NaN
Provence red blend
Domaine de la Bégude
In [64]:
input_data.country.dtype
Out[64]:
dtype('O')
In [65]:
input_data.price.dtype
Out[65]:
dtype('float64')
In [67]:
input_data.points.dtype
Out[67]:
dtype('int64')
In [68]:
input_data.points.astype("float64")
Out[68]:
0 96.0
1 96.0
2 96.0
3 96.0
4 95.0
5 95.0
6 95.0
7 95.0
8 95.0
9 95.0
10 95.0
11 95.0
12 95.0
13 95.0
14 95.0
15 95.0
16 95.0
17 95.0
18 95.0
19 95.0
20 95.0
21 95.0
22 95.0
23 95.0
24 95.0
25 94.0
26 94.0
27 94.0
28 94.0
29 94.0
...
150900 81.0
150901 81.0
150902 81.0
150903 81.0
150904 81.0
150905 80.0
150906 93.0
150907 92.0
150908 90.0
150909 89.0
150910 89.0
150911 87.0
150912 87.0
150913 94.0
150914 94.0
150915 93.0
150916 93.0
150917 92.0
150918 92.0
150919 91.0
150920 91.0
150921 91.0
150922 91.0
150923 91.0
150924 91.0
150925 91.0
150926 91.0
150927 91.0
150928 90.0
150929 90.0
Name: points, Length: 150930, dtype: float64
In [69]:
input_data.points.dtype
Out[69]:
dtype('int64')
In [70]:
input_data.points.astype("int64")
Out[70]:
0 96
1 96
2 96
3 96
4 95
5 95
6 95
7 95
8 95
9 95
10 95
11 95
12 95
13 95
14 95
15 95
16 95
17 95
18 95
19 95
20 95
21 95
22 95
23 95
24 95
25 94
26 94
27 94
28 94
29 94
..
150900 81
150901 81
150902 81
150903 81
150904 81
150905 80
150906 93
150907 92
150908 90
150909 89
150910 89
150911 87
150912 87
150913 94
150914 94
150915 93
150916 93
150917 92
150918 92
150919 91
150920 91
150921 91
150922 91
150923 91
150924 91
150925 91
150926 91
150927 91
150928 90
150929 90
Name: points, Length: 150930, dtype: int64
In [71]:
input_data.points.dtype
Out[71]:
dtype('int64')
In [72]:
input_data[input_data.country.isnull()]
Out[72]:
Unnamed: 0
country
description
designation
points
price
province
region_1
region_2
variety
winery
1133
1133
NaN
Delicate white flowers and a spin of lemon pee...
Askitikos
90
17.0
NaN
NaN
NaN
Assyrtiko
Tsililis
1440
1440
NaN
A blend of 60% Syrah, 30% Cabernet Sauvignon a...
Shah
90
30.0
NaN
NaN
NaN
Red Blend
Büyülübağ
68226
68226
NaN
From first sniff to last, the nose never makes...
Piedra Feliz
81
15.0
NaN
NaN
NaN
Pinot Noir
Chilcas
113016
113016
NaN
From first sniff to last, the nose never makes...
Piedra Feliz
81
15.0
NaN
NaN
NaN
Pinot Noir
Chilcas
135696
135696
NaN
From first sniff to last, the nose never makes...
Piedra Feliz
81
15.0
NaN
NaN
NaN
Pinot Noir
Chilcas
In [78]:
input_data["nonull_country"] = input_data.country.fillna("Unknown")
In [82]:
input_data[input_data.nonull_country.isnull()]
Out[82]:
Unnamed: 0
country
description
designation
points
price
province
region_1
region_2
variety
winery
nonull_country
In [85]:
input_data.loc[input_data["nonull_country"] =="Unknown"]
Out[85]:
Unnamed: 0
country
description
designation
points
price
province
region_1
region_2
variety
winery
nonull_country
1133
1133
NaN
Delicate white flowers and a spin of lemon pee...
Askitikos
90
17.0
NaN
NaN
NaN
Assyrtiko
Tsililis
Unknown
1440
1440
NaN
A blend of 60% Syrah, 30% Cabernet Sauvignon a...
Shah
90
30.0
NaN
NaN
NaN
Red Blend
Büyülübağ
Unknown
68226
68226
NaN
From first sniff to last, the nose never makes...
Piedra Feliz
81
15.0
NaN
NaN
NaN
Pinot Noir
Chilcas
Unknown
113016
113016
NaN
From first sniff to last, the nose never makes...
Piedra Feliz
81
15.0
NaN
NaN
NaN
Pinot Noir
Chilcas
Unknown
135696
135696
NaN
From first sniff to last, the nose never makes...
Piedra Feliz
81
15.0
NaN
NaN
NaN
Pinot Noir
Chilcas
Unknown
In [ ]:
#input_data.description.replace("@nose ", "@kerino")
In [ ]:
In [ ]:
Content source: muxiaobai/CourseExercises
Similar notebooks: