title: apply a function to dataframe
body: <p>I'm new to using apply:</p>
  
  <pre><code>import pandas
  df=pandas.DataFrame({"k1":['2017-03-07','2017-02-07','2017-01-15'],
                   "k2":[1,2,3],})
  </code></pre>
  
  <p>I want to get the data that matches some month. For example: I want to get the month == 2:</p>
  
  <pre><code>df[pandas.to_datetime(df.k1).dt.month == 2]
  </code></pre>
  
  <p>But I want to write a function with a parameter can match the month.
  this is my function. It doesn't work.</p>
  
  <pre><code>def get_month(df, mon=1):
      return df[pandas.to_datetime(df.k1).dt.month == mon]
  
  df.apply(get_month)
  </code></pre>