0

How do I return dictionary values with .values()? 'dict_values' object is not subscriptable, so I cannot use dict.values()[0] to retrieve the first array [2.96762712e+03, 8.38541299e-01, 1.32466671e-02]

dict_values([array([2.96762712e+03, 8.38541299e-01, 1.32466671e-02]), array([2.96762712e+03, 8.38541299e-01, 1.32466671e-02]), array([2.96762712e+03, 8.38541299e-01, 1.32466671e-02]), array([2.96762712e+03, 8.38541299e-01, 1.32466671e-02])])
Andy L.
  • 24,909
  • 4
  • 17
  • 29
Starbucks
  • 1,448
  • 3
  • 21
  • 49
  • This question has nothing to do with pandas. On `dict_values`, read https://docs.python.org/3/library/stdtypes.html#dictionary-view-objects for more info – Andy L. Feb 03 '20 at 18:24

1 Answers1

1

Convert to list prior to indexing:

list(dict.values())[0]
putty
  • 744
  • 1
  • 6
  • 14