title: applying function to dataframe; timestamp.dt
body: <p>Ultimately I want to calculate the number of days to the last day of the month from every date in <code>df['start']</code> and populate the <code>'count'</code> column with the result.</p>
  
  <p>As a first step towards that goal the <code>calendar.monthrange</code>
  method takes (year, month) arguments and returns a (first weekday, number of days) tuple.</p>
  
  <p>There seems to be a general mistake regarding applying functions to dataframes or series objects. I would like to understand, why this isn't working.</p>
  
  <pre><code>import numpy as np
  import pandas as pd
  import calendar
  
  def last_day(row):
      return calendar.monthrange(row['start'].dt.year, row['start'].dt.month)
  </code></pre>
  
  <p>This line raises an AttributeError: "Timestamp object has no attribute 'dt'":</p>
  
  <pre><code>df['count'] = df.apply(last_day, axis=1)
  </code></pre>
  
  <p>this is what my dataframe looks like:</p>
  
  <pre><code>       start  count
  0 2016-02-15    NaN
  1 2016-02-20    NaN
  2 2016-04-23    NaN
  
  df.dtypes
  
  start    datetime64[ns]
  count           float64
  dtype: object
  </code></pre>