title: pandas DataFrame type cast
body: <p>I'm trying to cast the type of a DataFrame using the function <code>astype</code> in the same way it is used in NumPy.</p>
  
  <p>First in NumPy:</p>
  
  <pre><code>In [175]: x = np.rec.array([('a','1'),('b','2')],names='col1,col2')
  
  In [176]: x
  Out[176]: 
  rec.array([('a', '1'), ('b', '2')], 
      dtype=[('col1', '|S1'), ('col2', '|S1')])
  
  In [177]: dt=[('col1', '|S1'), ('col2', 'i8')]
  
  In [178]: x.astype(dt)
  Out[178]: 
  rec.array([('a', 1), ('b', 2)], 
      dtype=[('col1', '|S1'), ('col2', '&lt;i8')])
  </code></pre>
  
  <p>Then in pandas:</p>
  
  <pre><code>In [182]: y = DataFrame([('a','1'),('b','2')], columns=['col1','col2'])
  
  In [183]: y
  Out[183]: 
    col1 col2
  0    a    1
  1    b    2
  
  In [184]: y.astype(dt)
  Out[184]: ---------------------------------------------------------------------------
  NotImplementedError                       Traceback (most recent call last)
  ...
  NotImplementedError: Not implemented for this type
  </code></pre>
  
  <p>I'm using pandas 0.7.3 and from the documentation on pandas 0.7.0 at <a href="http://pandas.sourceforge.net/generated/pandas.DataFrame.astype.html" rel="nofollow">http://pandas.sourceforge.net/generated/pandas.DataFrame.astype.html</a>. What's wrong? </p>