Re: Restricting Data from Wolfram|Alpha Input into Mathematica
- To: mathgroup at smc.vnet.net
- Subject: [mg126630] Re: Restricting Data from Wolfram|Alpha Input into Mathematica
- From: Jon Kongsvold <kongsvold at gmail.com>
- Date: Sun, 27 May 2012 04:41:13 -0400 (EDT)
- Delivered-to: l-mathgroup@mail-archive0.wolfram.com
- References: <jpq6r9$6ur$1@smc.vnet.net>
On May 26, 11:13 am, Mike McCraith <sandwaterh... at gmail.com> wrote: > Hello! > > I have the following code which brings up the number of cattle, by all > countries, in Africa. > > WolframAlpha["Number of Cattle in Africa", > IncludePods -> {"PropertyRanking:CountryData"}] I would not extract the data this way, it outputs a pod with an abbreviated list of nations and some unnecessary formatting for this problem. Clicking the small circle with an 'x' in the top right corner and choosing 'Computable data' from the list gives the complete list of three-element fields with this form: {rank, country, cattle}. > Is there any way of only displaying the values (country name and population > number) that are between 1 and 10 million for instance? This selects the values you are asking for: Select[WolframAlpha["Number of Cattle in Africa", {{"PropertyRanking:CountryData", 1}, "ComputableData"}], (#[[3]] >= 10^6 && #[[3]] <= 10^7) &][[All, 2 ;; 3]] > Also, is there an automatic way of extracting those values (population > numbers, not the country name) and then turning them into a data set? Ask Mathematica for the data part of the list, i.e. the third element. You can then use this list in any function which accepts a list of numbers as an argument. WolframAlpha["Number of Cattle in Africa", {{"PropertyRanking:CountryData", 1}, "ComputableData"}][[All, 3]] Hope this helps. Have a nice weekend, Jon > Thanks much for reading and any help! > > Mike