# How do I formulate a query on the data returned by ResourceData? [closed]

I struggle to answer the following question:

Use ResourceData["New Orleans Slave Sales 1856-1861"] to answer the following question: How many rows in which the NotaryFirstName contains the letter "e" (or "E") have no value (i.e. missing value) in the Price field?

Here is the beginning of my code where I could only find all the names in the data:

slavelist = ResourceData["New Orleans Slave Sales 1856-1861"]
namelist = slavelist[All, "NotaryFirstName"]


## closed as off-topic by Carl Lange, b3m2a1, Henrik Schumacher, MarcoB, LCarvalhoFeb 26 at 16:49

This question appears to be off-topic. The users who voted to close gave this specific reason:

• "This question arises due to a simple mistake such as a trivial syntax error, incorrect capitalization, spelling mistake, or other typographical error and is unlikely to help any future visitors, or else it is easily found in the documentation." – Carl Lange, b3m2a1, Henrik Schumacher, MarcoB, LCarvalho
If this question can be reworded to fit the rules in the help center, please edit the question.

• Length@slavelist[ Select[ (! MissingQ@#NotaryFirstName && StringContainsQ[#NotaryFirstName, "e"]) && MissingQ@#Price &]] Please read the documentation for Dataset, which has examples extremely similar to this question. I am voting to close this question as a) it's an obvious homework question and b) the answer is easily found in the documentation. – Carl Lange Feb 25 at 21:43

I am making this post to record the answer given by @CarlLange in a comment to the question.

Evaluating

slavelist = ResourceData["New Orleans Slave Sales 1856-1861"];


assigns a dataset to slavelist, so any valid dataset query can be used to extract information from slavelist. In this case, the appropriated query is

query =
slavelist[
Select[
! MissingQ @ #NotaryFirstName &&
StringContainsQ[#NotaryFirstName, "e", IgnoreCase -> True] &&
MissingQ @ #Price &]];


and then

Length @ query


1997

Note: I have modified Lange's code a little to make it conform more exactly to the criteria given in the question.