I have a relatively simple dataset that provides a list of values for a list of countries:
data = Dataset[{<|"GeoAreaName" -> Entity["Country", "Canada"], "Value" -> 5.2|>, <| "GeoAreaName" -> Entity["Country", "Swaziland"], "Value" -> 398|>, <|"GeoAreaName" -> Entity["Country", "SouthAfrica"], "Value" -> 781|>, <| "GeoAreaName" -> Entity["Country", "Switzerland"], "Value" -> 7.8|>, <|"GeoAreaName" -> Entity["Country", "UnitedStates"], "Value" -> 3.1|>}] I am wanting to thread the values from the first key to the values of the second key so that I get:
{Entity["Country", "Canada"] -> 5.2, Entity["Country", "Swaziland"] -> 398, Entity["Country", "SouthAfrica"] -> 781, Entity["Country", "Switzerland"] -> 7.8, Entity["Country", "UnitedStates"] -> 3.1} I am able to do this with the following code:
Thread[Normal[data[[All, 1]]] -> Normal[data[[All, 2]]]] While it works fine, I look at the code and think there must a simpler way that doesn't require me to first extract two lists and then recombine.
The actual code I am working on has quite a few more complexities than what I have listed here, so any simplification I can find will be greatly multiplied across all the work.
Curious if I am taking the long way around or if there is something more straight forward



