InsideDarkWeb.com

Accessing elements in Set

I am quite new to Python and thus struggling with its structures. Please ignore my silliness. I tried my best to find a solution but failed so far.

I have a set "self.gamma" which looks like

{<pomdpy.solvers.alpha_vector.AlphaVector object at 0x0000015E7B5F8908>, <pomdpy.solvers.alpha_vector.AlphaVector object at 0x0000015E7B5F8E48>, <pomdpy.solvers.alpha_vector.AlphaVector object at 0x0000015E7B5F8948>

I want to access its elements and I can do it this way:

[av.v for av in self.gamma]
[av.action for av in self.gamma]

which gives

[array([-95. ,   9.5]), array([  9.5, -95. ]), array([-0.95, -0.95])]
[1, 2, 0]

respectively. There are two types of data in the set – "v" (short for value) and "actions". Here is what I want to do:

  1. Do what I did without the for loop
  2. Access individual arrays from within self.gamma, e.g., self.gamma.v[0] should give me array([-95. , 9.5])

I hope I was clear with my question. Thank you in advance!

Stack Overflow Asked by lost_and_found on November 15, 2021

0 Answers

Add your own answers!

Related Questions

PSET 6 DNA: How to count number of runs of consecutive STRs

1  Asked on September 14, 2020 by leoness

   

IBM Watson Assistant: How to add more then 5 skills?

1  Asked on September 13, 2020 by always-prog

   

Empty array in c++ shows absurd behavior

2  Asked on September 13, 2020 by tonystark

 

why am I have to convert

0  Asked on September 12, 2020 by mer

 

How can i get the number and their unit?

4  Asked on September 12, 2020 by jdode

   

Validation form with optional fields react-hook-forms

1  Asked on September 10, 2020 by th3g3ntl3man

     

Another problem with unload function, node set to null is repopulating somehow

1  Asked on September 9, 2020 by pleasant-nightmares

   

get signature from TokenValidatedContext

2  Asked on September 8, 2020 by olaf-svenson

       

Boolean expression ( 0 or None and False)

1  Asked on September 7, 2020 by una

   

Ask a Question

Get help from others!

© 2021 InsideDarkWeb.com. All rights reserved.