# Median household income for each county in Maryland

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?

There is an easier way using WolframAlpha:

Using Mathematica (v10)

Reverse[SortBy[
Last]] // TableForm


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

data // TableForm


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

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

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


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

EntityValue[