import pandas as pd
pd.DataFrame({'Ja': [50, 21], 'Nein': [131, 2]})
|
Yes |
No |
|
|
0 |
50 |
131 |
|
1 |
21 |
2 |
pd.DataFrame({Fritz: ['Ich fands gut.', 'Grauenhaft!'], 'Zeynep': ['Toll!', 'Nicht gut']})
|
Fritz |
Zeynep |
|
|
0 |
Ich fands gut |
Toll! |
|
1 |
Grauenhaft! |
Nicht gut |
pd.DataFrame({'Fritz': ['Ich fands gut', 'Grauenhaft!'],
'Zeynep': ['Toll!', 'Nicht gut']},
index=['Produkt A', 'Produkt B'])
|
Fritz |
Zeynep |
|
|
Produkt A |
Ich fands gut |
Toll! |
|
Produkt B |
Grauenhaft! |
Nicht gut |
pd.Series([1, 2, 3, 4, 5])
0 1
1 2
2 3
3 4
4 5
dtype: int64
So gesehen ist eine Series eine einzelne Spalte von einem DataFrame. Du kannst denselben Befehl wie beim DataFrame nutzen um Zeilen
pd.Series([30, 35, 40], index=['2015 Sales', '2016 Sales', '2017 Sales'], name='Produkt A')
2015 Sales 30
2016 Sales 35
2017 Sales 40
Name: Produkt A, dtype: int64
Product A,Product B,Product C,
30,21,9,
35,34,1,
41,11,11
wine_reviews = pd.read_csv("../input/wine-reviews/winemag-data-130k-v2.csv")
wine_reviews.shape
(129971, 14)
wine_reviews.head()
|
Unnamed: 0 |
country |
description |
designation |
points |
price |
province |
region_1 |
region_2 |
taster_name |
taster_twitter_handle |
title |
variety |
winery |
|
|
0 |
0 |
Italy |
Aromas include tropical fruit, broom, brimston... |
Vulkà Bianco |
87 |
NaN |
Sicily & Sardinia |
Etna |
NaN |
Kerin O’Keefe |
@kerinokeefe |
Nicosia 2013 Vulkà Bianco (Etna) |
White Blend |
Nicosia |
|
1 |
1 |
Portugal |
This is ripe and fruity, a wine that is smooth... |
Avidagos |
87 |
15.0 |
Douro |
NaN |
NaN |
Roger Voss |
@vossroger |
Quinta dos Avidagos 2011 Avidagos Red (Douro) |
Portuguese Red |
Quinta dos Avidagos |
|
2 |
2 |
US |
Tart and snappy, the flavors of lime flesh and... |
NaN |
87 |
14.0 |
Oregon |
Willamette Valley |
Willamette Valley |
Paul Gregutt |
@paulgwine |
Rainstorm 2013 Pinot Gris (Willamette Valley) |
Pinot Gris |
Rainstorm |
|
3 |
3 |
US |
Pineapple rind, lemon pith and orange blossom ... |
Reserve Late Harvest |
87 |
13.0 |
Michigan |
Lake Michigan Shore |
NaN |
Alexander Peartree |
NaN |
St. Julian 2013 Reserve Late Harvest Riesling ... |
Riesling |
St. Julian |
|
4 |
4 |
US |
Much like the regular bottling from 2012, this... |
Vintner's Reserve Wild Child Block |
87 |
65.0 |
Oregon |
Willamette Valley |
Willamette Valley |
Paul Gregutt |
@paulgwine |
Sweet Cheeks 2012 Vintner's Reserve Wild Child... |
Pinot Noir |
Sweet Cheeks |
wine_reviews = pd.read_csv("../input/wine-reviews/winemag-data-130k-v2.csv", index_col=0)
wine_reviews.head()
|
country |
description |
designation |
points |
price |
province |
region_1 |
region_2 |
taster_name |
taster_twitter_handle |
title |
variety |
winery |
|
|
0 |
Italy |
Aromas include tropical fruit, broom, brimston... |
Vulkà Bianco |
87 |
NaN |
Sicily & Sardinia |
Etna |
NaN |
Kerin O’Keefe |
@kerinokeefe |
Nicosia 2013 Vulkà Bianco (Etna) |
White Blend |
Nicosia |
|
1 |
Portugal |
This is ripe and fruity, a wine that is smooth... |
Avidagos |
87 |
15.0 |
Douro |
NaN |
NaN |
Roger Voss |
@vossroger |
Quinta dos Avidagos 2011 Avidagos Red (Douro) |
Portuguese Red |
Quinta dos Avidagos |
|
2 |
US |
Tart and snappy, the flavors of lime flesh and... |
NaN |
87 |
14.0 |
Oregon |
Willamette Valley |
Willamette Valley |
Paul Gregutt |
@paulgwine |
Rainstorm 2013 Pinot Gris (Willamette Valley) |
Pinot Gris |
Rainstorm |
|
3 |
US |
Pineapple rind, lemon pith and orange blossom ... |
Reserve Late Harvest |
87 |
13.0 |
Michigan |
Lake Michigan Shore |
NaN |
Alexander Peartree |
NaN |
St. Julian 2013 Reserve Late Harvest Riesling ... |
Riesling |
St. Julian |
|
4 |
US |
Much like the regular bottling from 2012, this... |
Vintner's Reserve Wild Child Block |
87 |
65.0 |
Oregon |
Willamette Valley |
Willamette Valley |
Paul Gregutt |
@paulgwine |
Sweet Cheeks 2012 Vintner's Reserve Wild Child... |
Pinot Noir |
Sweet Cheeks |