title: How to iterate csv file and extract the data as a tuple at a time
body: <p>I have a CSV file and I am loading data and I want to iterate the data one at a time randomly to be passed to the agent for moving to the next state so that it represents one state to the reinforcement learning algorithm. The idea is to select the two latencies(latency1 and latency2) and compare it against the required latency if its less a reward of 1 is provided if it's greater than a reward of -1 is provided. The output is that RL will provide the layer which provides the minimum latency, and that point(layer number) will be considered for splitting. for instance RL provides layer3 so it means a DNN model will be split at layer3 into two sub-models.</p>
  <p>csv file(25 values)</p>
  <pre><code>layer  latency1 latency2 
  layer1  3.2        1.2
  layer2  2.1        0.2
  layer3  4.2        2.0 
  
  data_to_load = files.upload()
  data=pd.read_csv(io.BytesIO(data_to_load['rl_updated.csv']))
  data = data.set_index('Layer')
  data.head()    
  class Environment1: 
     def __init__(self, data):
       self.data = data     
     def step(self, act):
       self.take_action(action)
       reward = self.get_reward()
       ob = self.get_state()
       return ob, reward, done  # obs, reward, done
  
    def get_state(self):
      &quot;&quot;&quot;Get the observation.  it is a tuple &quot;&quot;&quot;
       for index, row in data.iterrows():
            ob=self.data
      return ob
  </code></pre>