[NumPy-Tickets] [NumPy] #1814: dtype field names cannot be unicode

NumPy Trac numpy-tickets@scipy....
Fri Apr 29 03:01:49 CDT 2011

#1814: dtype field names cannot be unicode
 Reporter:  Jon Olav Vik               |       Owner:  somebody   
     Type:  enhancement                |      Status:  new        
 Priority:  normal                     |   Milestone:  Unscheduled
Component:  numpy.core                 |     Version:  1.5.1      
 Keywords:  unicode record field name  |  
 Is there a reason why Unicode strings are not accepted as field names for
 record arrays?
 >>> np.dtype([("a", int)])
 dtype([('a', '<i4')])
 >>> np.dtype([(u"a", int)])
 TypeError: data type not understood
 A workaround is .encode("ascii").
 >>> np.dtype([(u"a".encode("ascii"), int)])
 dtype([('a', '<i4')])
 It is okay for the type specification to be Unicode.
 >>> np.dtype([("a", u"S2")])
 dtype([('a', '|S2')])}}}

 I came across this while building a record array from data in a Microsoft
 Excel spreadsheet using pythoncom and win32com. Converting to ascii isn't
 too much of a hassle, but maybe it wouldn't be difficult to allow Unicode
 strings as field names?

Ticket URL: <http://projects.scipy.org/numpy/ticket/1814>
NumPy <http://projects.scipy.org/numpy>
My example project

More information about the NumPy-Tickets mailing list