title: Use function (not using lambda) with apply method for pandas DataFrame
body: <p>I am trying to add column according to the existing column in dataframe following this <a href="https://stackoverflow.com/questions/36213383/pandas-dataframe-how-to-apply-function-to-a-specific-column">page</a>.<br>
  Since there are many if case, I defined the if case as function (getDirection method) and tried to call by apply method(addDirection method).<br>
  Howerver, I got following error.  </p>
  
  <pre><code>TypeError: getDirection() takes 1 positional argument but 2 were given  
  </code></pre>
  
  <p>Can anyone tell how I can call function by apply for dataframe?<br>
  Code is shown below.  </p>
  
  <pre><code>def addDirection(self):
      group=self.group
      group['direction']=group['Azimuth [deg]'].apply(self.getDirection)
  
     def getDirection(angle):
          if angle &lt; 11.25 or angle &gt;= 348.75:
              return "N"
          elif angle &lt; 33.75 and angle &gt;= 11.25:
              return "NNE"
          elif angle &lt; 56.25 and angle &gt;= 33.75:
              return "NE"
          elif angle &lt; 78.75 and angle &gt;= 56.25:
              return "ENE"
          elif angle &lt; 101.25 and angle &gt;= 78.75:
              return "E"
          elif angle &lt; 123.75 and angle &gt;= 101.25:
              return "ESE"
          elif angle &lt; 146.25 and angle &gt;= 123.75:
              return "SE"
          elif angle &lt; 168.75 and angle &gt;= 146.25:
              return "SSE"
          elif angle &lt; 191.25 and angle &gt;= 168.75:
              return "S"
          elif angle &lt; 213.75 and angle &gt;= 191.25:
              return "SSW"
          elif angle &lt; 236.25 and angle &gt;= 213.75:
              return "SW"
          elif angle &lt; 258.75 and angle &gt;= 236.25:
              return "WSW"
          elif angle &lt; 281.25 and angle &gt;= 258.75:
              return "W"
          elif angle &lt; 303.75 and angle &gt;= 281.25:
              return "WNW"
          elif angle &lt; 326.25 and angle &gt;= 303.75:
              return "NW"
          elif angle &lt; 348.75 and angle &gt;= 326.25:
              return "NNW"
  </code></pre>