[Solved] Mapping Length over each class in EntityClassList["Chemical"]

As of now I have to find the individual lengths of each chemical class in this data set individually, but I was looking for a way that I could find the length of each individual chemical class at once.

Hi

Try this

list = EntityClassList["Chemical"];
EntityValue[#, "EntityCount"] & /@ list

Thank you so much! Would it be possible that the numerical values in the output have their corresponding chemical class next to them so it is easier to undestand?

then you use Thread for both outputs, here is the whole operation

list = EntityClassList["Chemical"];
len = EntityValue[#, "EntityCount"] & /@ list;
Thread[{list, len}]

Another option would be to use a singe Map:

Map[
 {#, EntityValue[#, "EntityCount"]} &,
 EntityClassList["Chemical"]
 ]

Thank you both. This is exactly what I was looking for!

As an Association

AssociationMap[EntityValue[#, "EntityCount"] &, EntityClassList["Chemical"]]