title: Pandas: convert date 'object' to int
body: <p>I have a Pandas dataframe and I need to convert a column with dates to int but unfortunately all the given solutions end up with errors (below)</p>
  
  <pre><code>test_df.info()
  
  &lt;class 'pandas.core.frame.DataFrame'&gt;
  Data columns (total 4 columns):
  Date        1505 non-null object
  Avg         1505 non-null float64
  TotalVol    1505 non-null float64
  Ranked      1505 non-null int32
  dtypes: float64(2), int32(1), object(1) 
  </code></pre>
  
  <p>sample data:</p>
  
  <pre><code>    Date        Avg             TotalVol  Ranked
  0   2014-03-29  4400.000000     0.011364    1
  1   2014-03-30  1495.785714     4.309310    1
  2   2014-03-31  1595.666667     0.298571    1
  3   2014-04-01  1523.166667     0.270000    1
  4   2014-04-02  1511.428571     0.523792    1
  </code></pre>
  
  <p>I think that I've tried everything but nothing works</p>
  
  <pre><code>test_df['Date'].astype(int):
  </code></pre>
  
  <p>TypeError: int() argument must be a string, a bytes-like object or a number, not 'datetime.date'</p>
  
  <pre><code>test_df['Date']=pd.to_numeric(test_df['Date']):
  </code></pre>
  
  <p>TypeError: Invalid object type at position 0</p>
  
  <pre><code>test_df['Date'].astype(str).astype(int):
  </code></pre>
  
  <p>ValueError: invalid literal for int() with base 10: '2014-03-29'</p>
  
  <pre><code>test_df['Date'].apply(pd.to_numeric, errors='coerce'):
  </code></pre>
  
  <p>Converts the entire column to NaNs</p>