For any and all questions relating to Challenge 20 post away!

Can anyone help me understand what the x axis on the histogram is meant to be? I found it to be confusing and wasnâ€™t sure how to interpret it to get the answer to the first question.

1 Like

Sure, histogram just need a x-axis value to plot distribution.
The population in the dataset has hug variation in terms of numbers.
Therefore, scale x value is needed.
Here is the hint, click_me.
Once you scaled down the x-axis value, you can set the number of bins you want to see the entire distribution.
Check on x_axis value, it should be 1e7 which is one million as a based shown on the x-axis. Good luck!

3 Likes

Any hints on how to find the schema of world.db?

@DrDave Not sure if youâ€™ll need itâ€¦ the Challenge Q specifies which table to use:

Pull the data from the worldcities table in the world.db database to the pandas DataFrame

1 Like

Keep in mind that in a histogram the x-axis represents the buckets for the outcomes, and the y-axis represents the number/percentage of occurrences of that bucket.

For example:
If we are asked to show how many people in a pool are within a specific age group, the x-axis would be our age groups and the y-axis would be the number of people in those age groups. So our bins (x-axis) could be Ages 0-5, 6-10, 11-18, 19-25, etc.

1 Like

Thank you. I was getting WAY too complicated!

isnâ€™t 1e7 = 10 million?

Assuming youâ€™re using matplotlib, you can force the x-axis to be millions by adding this line:

`plt.ticklabel_format(axis="x", style="sci", scilimits=(6,6))`

3 Likes

Anyone else seeing an incorrect country in the second spot for population? The top spot shows as correct but number 2 is not.

The top spot shows as correct but number 2 is not.

What do you mean exactly? Do you mean that the dataframe table, when sorted by population size, does not give an order or population numbers that matches other lists of population sizes?

I think thatâ€™s because there are multiple ways to measure the population size of a city. For example, some lists give population size in â€śthe city properâ€ť, while others give the size for â€śthe metropolitan areaâ€ť. If you look at this wikipedia page, our list is very different from the one on that page when looking at population in the â€ścity properâ€ť, but quite similar when looking at â€śmetropolitan areaâ€ť.

Edit: If youâ€™re asking if the â€śofficial answerâ€ť to the second question is incorrect, Iâ€™d say yes and no. It depends how you interpret the question.

• If you interpret the 2nd question very literally (as asking â€śwhat country in the world right now has the largest population sizeâ€ť), then the official (accepted) answer is correct.
• If you interpret the question as asking â€śin the `world.db` file, what country has the city with the largest populationâ€ť, then I agree that the â€śofficialâ€ť (accepted) answer is incorrect.

Either way, I think the way the question is worded is misleading. @LHL this is probably a question you want to re-word in the future!

1 Like

Welcome to the penultimate day of your coding challenge. Give it your best shot!

I think I had that problem too. I got maxed out on attempts and when I looked at the solution code and the multiple choice answer, the second question answer didnâ€™t match. I took a screen shot as that seemed so weird! And even weirder, the answer on the multichoice that shows as correct was actually one I had guessed :S

Hello!

Even though I clicked the correct answer, when I submitted the answer (2nd attempt) it says that I got 0 points for this question â€¦ could a moderator (@Denverdias @caroLHL ) please check if this was an issue as a result of the website or perhaps I did click the wrong answer?

Thanks so much for the time and happy coding!

2 Likes

Thatâ€™s why I was so confused. I missed the â€ś1e7â€ť. It is 10 million, but that makes sense given that weâ€™re mostly worried about how the data relates to 5 million (or 0.5 of 10 million) or 10 million (1.0) to get our first answer.

I think the final statement â€śWhich country is two most populated?â€ť itâ€™s the tricky part.

1 Like