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,086
  • 3
  • 14
  • 26
Starbucks
  • 1,335
  • 2
  • 18
  • 35
  • 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
  • 657
  • 1
  • 5
  • 13