Message Boards Message Boards

0
|
3337 Views
|
1 Reply
|
0 Total Likes
View groups...
Share
Share this post:

Map Over Calls to EntityData

Posted 10 years ago

Hi, All

I was playing around with the EntityData[] function, specifically seeing the depth of information coverage at the provincial level for my home country of Canada.

I got the list of all possible attributes, which I stored as a list named props, and ran the following...

EntityValue[ Entity["AdministrativeDivision", {"Ontario", "Canada"}], #] & /@ props

It took quite a long time to complete (in the order of a minute or so), and, not surprisingly, quite a few of the fields came back as Missing[DataNotAvailable]. This, as I say, is not surprising, as many of the properties would only make sense at the national level.

But I was concerned about the time required, and wondered whether this might be due to missing data. So I shortened the list to just those properties that came back with data in the first pass, naming the list populatedProperties. The time using the Map above was still very long.

So I ran them individually by hand (there were only 11) rather than using my Map statement as above, and they all came back individually very quickly. I could easily run the calls individually in less time than it takes the Map statement to work.

And the following...

EntityValue[ Entity["AdministrativeDivision", {"Ontario", "Canada"}], populatedProperties]

...comes back almost instantaneously.

I suppose in retrospect my last attempt does make the most sense. But it doesn't make sense that calling EntityValue multiple times "by hand" should be quite a bit faster than trying to get Map to do the heavy lifting.

Is there anything wrong with my Map statement? Is there any reason why multiple hits via Map should be slow?

Thanks in advance for any suggestions.

Brad

POSTED BY: Brad Varey

Perhaps there is some issue today with the Wolfram servers. The following executed very quickly yesterday. However, today it takes a minute or more:

CountryData[#, {"SectorLaborFractions"}] & /@ CountryData[]

But, oddly,

CountryData[#, "SectorLaborFractions"] & /@ CountryData[]

returns very quickly.

POSTED BY: David Reiss
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