Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.soft-sys.math.mathematica > #10219 > unrolled thread
| Started by | Mike McCraith <sandwaterhand@gmail.com> |
|---|---|
| First post | 2012-05-26 09:13 +0000 |
| Last post | 2012-05-27 08:42 +0000 |
| Articles | 2 — 2 participants |
Back to article view | Back to comp.soft-sys.math.mathematica
Restricting Data from Wolfram|Alpha Input into Mathematica Mike McCraith <sandwaterhand@gmail.com> - 2012-05-26 09:13 +0000
Re: Restricting Data from Wolfram|Alpha Input into Mathematica Jon Kongsvold <kongsvold@gmail.com> - 2012-05-27 08:42 +0000
| From | Mike McCraith <sandwaterhand@gmail.com> |
|---|---|
| Date | 2012-05-26 09:13 +0000 |
| Subject | Restricting Data from Wolfram|Alpha Input into Mathematica |
| Message-ID | <jpq6r9$6ur$1@smc.vnet.net> |
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"}]
Is there any way of only displaying the values (country name and population
number) that are between 1 and 10 million for instance?
Also, is there an automatic way of extracting those values (population
numbers, not the country name) and then turning them into a data set?
Thanks much for reading and any help!
Mike
[toc] | [next] | [standalone]
| From | Jon Kongsvold <kongsvold@gmail.com> |
|---|---|
| Date | 2012-05-27 08:42 +0000 |
| Message-ID | <jpspd1$hcd$1@smc.vnet.net> |
| In reply to | #10219 |
On May 26, 11:13 am, Mike McCraith <sandwaterh...@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
[toc] | [prev] | [standalone]
Back to top | Article view | comp.soft-sys.math.mathematica
csiph-web