title: Python Self - TypeError: add_state() takes exactly 4 arguments (3 given)
body: <p>I am trying to solve the stagecoach problem with agent based simulation.  I am trying to add the states to a Panda's dataframe.  However, when doing this, I am getting the error "TypeError: add_state() takes exactly 4 arguments (3 given)."  I have looked at other questions on Stackoverflow and tried the solutions, but there is something that I'm missing.  </p>
  
  <p>Can someone please give me some advice or hints as to why I keep getting this error?  Thank you for your time.</p>
  
  <pre><code>from __future__ import division
  import random
  import pandas as pd
  
  
  class stagecoach():
  
      current_state = "A"
      home_state = "J"
      cost = 0
  
      index = range(1,20,1)
      columns = ["Current", "Choices", "Cost"]
  
      states = pd.DataFrame(columns=columns, index=index)
  
      counter = 1
  
      def add_state(self, s_current, s_choices, s_cost):
          self.states.loc[self.counter] = [s_current, s_choices, s_cost]
          self.counter += 1
  
      add_state("A", "B", 2)
      add_state("A", "C", 4)
      add_state("A", "D", 3)
      add_state("B", "E", 7)
      add_state("B", "F", 4)
      add_state("B", "G", 6)
      add_state("C", "E", 3)
      add_state("C", "F", 2)
      add_state("C", "G", 4)
      add_state("D", "E", 4)
      add_state("D", "F", 1)
      add_state("D", "G", 5)
      add_state("E", "H", 1)
      add_state("E", "I", 4)
      add_state("F", "H", 6)
      add_state("F", "I", 3)
      add_state("G", "H", 3)
      add_state("G", "I", 3)
      add_state("H", "J", 3)
      add_state("I", "J", 4)
  
  
  
      def choose(self,state):
          states_to_choose = self.states[self.states.Current == state]
          random_path = random.randint(0,len(states_to_choose))
          current_state = states_to_choose[random_path]
  
  
      def run(self):
          while self.current_state != self.home_state:
              print(self.states)
              self.choose(self.current_state)
              print(self.current_state)
              self.cost += 1
  
  
  
  game = stagecoach()
  game.run()
  </code></pre>