title: Regression with Date variable using Scikit-learn
body: <p>I have a Pandas DataFrame with a <code>date</code> column (eg: <code>2013-04-01</code>) of dtype <code>datetime.date</code>. When I include that column in <code>X_train</code> and try to fit the regression model, I get the error <code>float() argument must be a string or a number</code>. Removing the <code>date</code> column avoided this error.</p>
  
  <p>What is the proper way to take the <code>date</code> into account in the regression model?</p>
  
  <p><strong>Code</strong></p>
  
  <pre><code>data = sql.read_frame(...)
  X_train = data.drop('y', axis=1)
  y_train = data.y
  
  rf = RandomForestRegressor().fit(X_train, y_train)
  </code></pre>
  
  <p><strong>Error</strong></p>
  
  <pre><code>TypeError                                 Traceback (most recent call last)
  &lt;ipython-input-35-8bf6fc450402&gt; in &lt;module&gt;()
  ----&gt; 2 rf = RandomForestRegressor().fit(X_train, y_train)
  
  C:\Python27\lib\site-packages\sklearn\ensemble\forest.pyc in fit(self, X, y, sample_weight)
      292                 X.ndim != 2 or
      293                 not X.flags.fortran):
  --&gt; 294             X = array2d(X, dtype=DTYPE, order="F")
      295 
      296         n_samples, self.n_features_ = X.shape
  
  C:\Python27\lib\site-packages\sklearn\utils\validation.pyc in array2d(X, dtype, order, copy)
       78         raise TypeError('A sparse matrix was passed, but dense data '
       79                         'is required. Use X.toarray() to convert to dense.')
  ---&gt; 80     X_2d = np.asarray(np.atleast_2d(X), dtype=dtype, order=order)
       81     _assert_all_finite(X_2d)
       82     if X is X_2d and copy:
  
  C:\Python27\lib\site-packages\numpy\core\numeric.pyc in asarray(a, dtype, order)
      318 
      319     """
  --&gt; 320     return array(a, dtype, copy=False, order=order)
      321 
      322 def asanyarray(a, dtype=None, order=None):
  
  TypeError: float() argument must be a string or a number
  </code></pre>