4
$\begingroup$

I found that Wolfram|Alpha knows the median household income for every county in the US. I wanted to get a list of all counties in Maryland, and the median income in each county. The only way I could find to do that is to first query for a list of counties in Maryland. After that I queried each county individually. That gave me lots of data on each county, but I only care about median household income. This approach required 25 queries. Is there an easier way using Wolfram|Alpha? Also, how would I learn how to this in Mathematica without a Wolfram|Alpha query?

$\endgroup$
3
$\begingroup$

There is an easier way using WolframAlpha:

enter image description here

$\endgroup$
8
$\begingroup$

Using Mathematica (v10)

Reverse[SortBy[
         EntityClass["AdministrativeDivision","USCountiesMaryland"][{"Name","MedianHouseholdIncome"}], 
         Last]] // TableForm

enter image description here

$\endgroup$
  • $\begingroup$ How would one do this for racial makeup, a table of white, black, Native American, etc.? $\endgroup$ – gotwals Jun 19 '18 at 11:49
  • $\begingroup$ I don't think Wolfram has that information. See EntityProperty["AdministrativeDivision", "MedianHouseholdIncome"]["Qualifiers"] vs EntityProperty["AdministrativeDivision", "Population"]["Qualifiers"] $\endgroup$ – chuy Jun 19 '18 at 14:01
6
$\begingroup$
data = WolframAlpha["median income in Maryland counties", {{"PropertyRanking:ACSData",  1}, 
                    "ComputableData"}];

data // TableForm

enter image description here

$\endgroup$
  • $\begingroup$ Can we infer anything about where lobbyists reside? $\endgroup$ – Mike Honeychurch Mar 5 '15 at 22:47
1
$\begingroup$

We can learn the syntax though CTRL+= counties of maryland median household income, which gives

EntityClass["AdministrativeDivision", "USCountiesMaryland"][EntityProperty["AdministrativeDivision", "MedianHouseholdIncome"]]

enter image description here

We can adapt this piece of generated code to return the counties too.

EntityValue[
  EntityClass["AdministrativeDivision", "USCountiesMaryland"], 
  EntityProperty["AdministrativeDivision", "MedianHouseholdIncome"],
  "EntityAssociation"
]

enter image description here

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.