1
$\begingroup$

Why one entity is a List Object? There are many such cases. They are in one level/one region/province.

CityData[{"Anqing", "Anhui", "China"}]
(* Entity["City", {"Anqing", "Anhui", "China"}] *)

CityData[{"Bangbu", "Anhui", "China"}]
(* {Entity["City", {"Bengbu", "Anhui", "China"}]} *)

enter image description here

$\endgroup$
  • $\begingroup$ Please add text instead of screenshots so we can copy/paste/evaluate. I assume here that one of these is an entity, but the other is an entity class with one member. $\endgroup$ – Jason B. Jan 23 '18 at 15:46
3
$\begingroup$

That's an old design: if the input matches exactly the standard name, it will return the entity by itself. If the input is not a valid standard name, it will try to find the possible entities the input refers to. In the second case you could have asked without the region for example:

In[1]:= CityData[{"Bangbu", "China"}]

Out[1]= {Entity["City", {"Bengbu", "Anhui", "China"}]}

Of course, the answer would have been more than one if many cities have the same name, like with springfield cities:

In[2]:= CityData[{"springfield", "Wisconsin", "UnitedStates"}]

Out[128]= {Entity["City", {"Springfield", "Wisconsin", "UnitedStates"}], 
    Entity["City", {"SpringfieldStCroix", "Wisconsin", "UnitedStates"}], 
    Entity["City", {"SpringfieldMarquette", "Wisconsin", "UnitedStates"}], 
    Entity["City", {"SpringfieldJackson", "Wisconsin", "UnitedStates"}]}

In this last case I did input "springfield" with lowercase instead of uppercase to avoid matching the exact standardname for the first entity.

$\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.