Chp 10 Flashcards

Quiz-07 - Data wrangling using pandas

1
Q

Given the following DataFrame named oo , which three countries have won the most medals in recent years (from 1984 to 2008)?

Fill the blank.

rec = oo[oo.Edition >= 1984]
rec[“NOC”]._______.head(3)

A

value_counts()

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Given the following DataFrame named oo, list only the NOC column.

A

oo[‘NOC’]
oo.NOC
oo.iloc[:,5]
oo[“NOC”]

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Given the following DataFrame named oo , list the total number of medals awarded at each of the Olympic games throughout history.

Fill the blank.

oo.groupby(_____).size()

A

‘Edition’
“Edition”

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Given the following DataFrame named oo , in which events did “HERSCHMANN, Otto” win a medal?

Fill the blank.

oo[________][‘Event’]

A

oo.Athlete == ‘“HERSCHMANN, Otto”
oo.Athlete == ‘HERSCHMANN, Otto’
oo[“Athlete”] == ‘HERSCHMANN, Otto’
oo[‘Athlete’] == ‘HERSCHMANN, Otto’
oo[‘Athlete’] == “HERSCHMANN, Otto”
oo[“Athlete”] == “HERSCHMANN, Otto”
oo.Athlete.str.contains(‘HERSCHMANN, Otto’)
oo.Athlete.str.contains(“HERSCHMANN, Otto”)
oo[“Athlete”].str.contains(“HERSCHMANN, Otto”)
oo[‘Athlete’].str.contains(“HERSCHMANN, Otto”)
oo[“Athlete”].str.contains(‘HERSCHMANN, Otto’)
oo[‘Athlete’].str.contains(‘HERSCHMANN, Otto’)
oo.Athlete==’“HERSCHMANN, Otto”
oo.Athlete==’HERSCHMANN, Otto’
oo[“Athlete”]==’HERSCHMANN, Otto’
oo[‘Athlete’]==’HERSCHMANN, Otto’
oo[‘Athlete’]==”HERSCHMANN, Otto”
oo[“Athlete”]==”HERSCHMANN, Otto”

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Given the following DataFrame named oo , list the total number of medals won for each country for each year over the history of the Olympics.

oo.groupby(____).size()

A

[‘Edition’, ‘NOC’]
[‘Edition’, ‘“NOC”]
[“Edition”, ‘NOC’]
[“Edition”, “NOC”]
[‘NOC’, ‘Edition’]
[‘“NOC”, ‘Edition’]
[‘NOC’, “Edition”]
[“NOC”, “Edition”]

How well did you know this?
1
Not at all
2
3
4
5
Perfectly