1. Tables
You are given the following table called pokemon. For the following questions, fill in the blanks.
1. Find the name of the pokemon of type Waterthat has the highest HP.
waterpokemon = pokemon. ( , )
waterpokemon. ( , ).column("Name").item(0)
waterpokemon = pokemon.where("Type", are.equalto("Water"))
waterpokemon.sort("HP",descending=True).column("Name").item(0)
2. Find the proportion of pokemon of type Firein the dataset whose Speed is strictly less than 100.
firepokemon=pokemon. ( , )
firepokemon. ( , ). /
firepokemon = pokemon.where("Type", "Fire")
firepokemon.where("Speed", are.below(100)).numrows / firepokemon.numrows
3. Create a table containing
Type and Generation that is sorted in decreasing order by the average HP for
each pair of Typeand Generation.
d=pokemon. ( , )
d.sort("HPmean", ). ( , )
1
, d=pokemon.group(make array("Type","Generation"),np.mean)
d.sort("HPmean",descending=True).select("Type","Generation")
or
d=pokemon.group(["Type","Generation"],np.mean)
4. Return an array that contains ratios of legendary to non-legendary pokemons for each generation.
t=pokemon. ( , )
ratio=t. ( )/t. ( )
t=pokemon.pivot("Legendary","Generation")
ratio=t.column("True")/t.column("False")
2. Histograms
Everyone knows Zoomers love their avocado toast, so it comes as no surprise that this Hass Avocado dataset
was a popular selection among your peers! Each type of avocado (PLU 4046, PLU 4225, PLU 4770) has a
corresponding histogram below; each data point in the histogram represents the number of avocados sold in
one order. All bars are 1000 units wide, but take note: the density scale is different in each histogram.
There are 16812 orders shown in the PLU 4046 histogram and 19572 orders shown in the PLU 4225
histogram.
1. Calculate each quantity described below or write Unknown if there is not enough information above to
express the quantity as a single number (not a range). Show your work!
2