title: How to pass a numpy array of string types to a function in Cython
body: <p>Passing a numpy array of dtype <code>np.float64_t</code> works fine ( below), but I can't pass string arrays.</p>
  
  <p><strong>This is what works :</strong> </p>
  
  <pre><code># cython_testing.pyx
  import numpy as np
  cimport numpy as np
  
  ctypedef np.float64_t dtype_t 
  
  cdef func1 (np.ndarray[dtype_t, ndim=2] A):
      print A 
  
  def testing():
      chunk = np.array ( [[94.,3.],[44.,4.]], dtype=np.float64)
  
      func1 (chunk)
  </code></pre>
  
  <p><strong>But I can't make this work:</strong>
  I can't find the matching 'type identifiers' for numpy string dtypes.</p>
  
  <pre><code># cython_testing.pyx
  import numpy as np
  cimport numpy as np
  
  ctypedef np.string_t dtype_str_t 
  
  cdef func1 (np.ndarray[dtype_str_t, ndim=2] A):
      print A 
  
  def testing():
      chunk = np.array ( [['huh','yea'],['swell','ray']], dtype=np.string_)
  
      func1 (chunk)
  </code></pre>
  
  <p><strong>The compilation error is :</strong> </p>
  
  <pre><code>Error compiling Cython file:
  ------------------------------------------------------------
  ctypedef np.string_t dtype_str_t 
      ^
  ------------------------------------------------------------
  
  cython_testing.pyx:9:9: 'string_t' is not a type identifier
  </code></pre>
  
  <p><strong>UPDATE</strong></p>
  
  <p>Per looking through <code>numpy.pxd</code>, I see the following <code>ctypedef</code> statements. Maybe that's enough to say I can use <code>uint8_t</code> and pretend everything is normal, as long as I can do some casting?</p>
  
  <pre><code>ctypedef unsigned char      npy_uint8
  ctypedef npy_uint8      uint8_t
  </code></pre>
  
  <p>Just have to see how expensive that casting will be.</p>