2
$\begingroup$

I have following statement:

EntityValue["Planet", "VelocityAroundSun", {"Date" -> 
DateObject[{2020, 2, 19}, "Day", "Gregorian", 1.]}]

and get the required output in a form I don't understand, see below. I want to extract the list with velocities from this output into a simple list. How can I do that ?

{("Date" -> 
     DateObject[{2020, 2, 19}, "Day", "Gregorian", 1.])[{Quantity[
     55.9314, ("Kilometers")/("Seconds")], 
    Quantity[35.1845, ("Kilometers")/("Seconds")], 
    Quantity[30.1244, ("Kilometers")/("Seconds")], 
    Quantity[24.0561, ("Kilometers")/("Seconds")], 
    Quantity[13.0407, ("Kilometers")/("Seconds")], 
    Quantity[9.14217, ("Kilometers")/("Seconds")], 
    Quantity[6.57181, ("Kilometers")/("Seconds")], 
    Quantity[5.44866, ("Kilometers")/("Seconds")]}]}[3]
$\endgroup$
1
  • $\begingroup$ You have incorrect syntax for an EntityProperty qualifier. You should have EntityValue["Planet", EntityProperty["Planet", "VelocityAroundSun", {"Date" -> DateObject[{2020, 2, 19}, "Day", "Gregorian", 1.]}]] $\endgroup$
    – Edmund
    Feb 21, 2020 at 22:35

1 Answer 1

1
$\begingroup$

You can wrap the property with Dated

EntityValue["Planet", Dated["VelocityAroundSun", Today]]

enter image description here

or use EntityProperty[...] to specify the dated property:

EntityValue["Planet", EntityProperty["Planet", "VelocityAroundSun", {"Date" -> Today}]]

same result

Property values on a different date:

EntityValue["Planet", Dated["VelocityAroundSun", DatePlus[Today, {1, "Month"}]]]

enter image description here

Use QuantityMagnitude to get the numbers:

QuantityMagnitude @ EntityValue["Planet", Dated["VelocityAroundSun", Today]]

{125227., 78704.8, 67387.4, 53808.5, 29171.1, 20450.4, 14700.7, 12188.3}

or use QuantityMagnitude as third argument in EntityValue:

EntityValue["Planet", "VelocityAroundSun", QuantityMagnitude]

same result

Use the third argument of EntityValue to get the result as an Association object:

EntityValue["Planet", Dated["VelocityAroundSun", DatePlus[Today, {1, "Month"}]], 
   "EntityAssociation"]

enter image description here

Note: Why are you getting "a form I don't understand":

The third argument of EntityValue is used as a function that is applied to the result returned:

EntityValue["Planet", "VelocityAroundSun", foo]

enter image description here

$\endgroup$
1
  • 1
    $\begingroup$ Based on comments most simple seems: QuantityMagnitude@ EntityValue["Planet", Dated["VelocityAroundSun", Today]] $\endgroup$
    – Jacq
    Feb 20, 2020 at 11:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.