Message Boards Message Boards

0
|
9271 Views
|
8 Replies
|
6 Total Likes
View groups...
Share
Share this post:
GROUPS:

Not sure how to word a fairly complicated data request

Posted 9 years ago

Hi,

I want to find out how many cities on earth had a population greater than one million people in 1994. I've found I can ask for the number of cities that meet that criteria today without a problem, and I can query individual city's populations for 1994, but Wolfram keeps getting stuck at the combination request. Does anyone know how to approach the grammar to make it clear to the parser what I'm intending to ask?

Thanks! d

POSTED BY: Dylan Hendricks
8 Replies

Hi,

no idea for WolframAlpha, but it seems to be working in the Wolfram Language.

countriespop1994 = {CommonName[#], CountryData[#, {"Population", 1994}]} & /@ CountryData[] //TableForm

The first lines of the output look like this:

enter image description here

If you need that data, you could open up a free (!) WolframCloud account and use the Wolfram language there. For your convenience I have attached the file with the data in csv format

Cheers,

M.

Attachments:
POSTED BY: Marco Thiel

Thanks!

POSTED BY: Dylan Hendricks

Hi Marco, Thanks for your information, but is there a way to count this data (population) in MM?

Cheers,...Jos

POSTED BY: Jos Klaps

Hi Jos,

I am not quite sure what you mean by count. Once you have the population sizes you can to anything you want with them. They do come as a quantity with unit ("people"), so if you want just the plain counting numbers you can use:

MapAt[QuantityMagnitude, countriespop1994, {All, 2}]

The countries for which the population size is unknown can be dealt with using:

MapAt[QuantityMagnitude, Select[countriespop1994, NumberQ[QuantityMagnitude[#[[2]]]] & ], {All, 2}]

Once you have done that you should be able to count these numbers, add them up etc.

I am not sure though whether that answers your question.

Cheers,

M.

POSTED BY: Marco Thiel

I'm actually looking for city populations, a list that I imagine would be too long to generate without filtering. Wolfram is capable of generating a list of 608 cities that currently have a population over 1 million, it would work if I could even run this same list of cities through a query of 1994 population, and filter out those below a million. But I'm not sure how to extend an existing query like that. Any advice? (even a link to the list of known data structures that you reference above would be helpful)

Thanks, d

POSTED BY: Dylan Hendricks

Hi Marco, Thanks for your reply. What I'm looking for is the total numbers of population of all listed countries (countriespop1994) by counting (Quantity) the number of people in total.

Cheers,...Jos

POSTED BY: Jos Klaps

Hi Jos,

do you mean:

Total@Select[QuantityMagnitude /@ countriespop1994[[All, 2]], NumberQ]
(*5642772619*)

Cheers,

M.

POSTED BY: Marco Thiel

Hi Marco,

Yes, thanks for your support.

Cheers,......Jos

POSTED BY: Jos Klaps
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract