[Numpy-tickets] [NumPy] #483: Junk in the representation of string fields of recarrays
NumPy
numpy-tickets@scipy....
Wed Mar 28 03:37:26 CDT 2007
#483: Junk in the representation of string fields of recarrays
--------------------+-------------------------------------------------------
Reporter: faltet | Owner: somebody
Type: defect | Status: new
Priority: normal | Milestone:
Component: Other | Version:
Severity: normal | Keywords:
--------------------+-------------------------------------------------------
The next exposes the problem:
{{{
In [27]:r=numpy.array([['abc']], dtype=[('var1', '|S20')])
In [28]:r['var1']
Out[28]:
array([['abc\xb7\x08\xc1+\x08\xc0>\xde\xb7@\xec\x95\xb7`\xec\x95\xb7']],
dtype='|S20')
In [30]:r['var1'][0]
Out[30]:
array(['abc\xb7\x08\xc1+\x08\xc0>\xde\xb7@\xec\x95\xb7`\xec\x95\xb7'],
dtype='|S20')
In [31]:r['var1'][0][0]
Out[31]:'abc\xb7\x08\xc1+\x08\xc0>\xde\xb7@\xec\x95\xb7`\xec\x95\xb7'
In [32]:str(r['var1'][0][0])
Out[32]:'abc\xb7\x08\xc1+\x08\xc0>\xde\xb7@\xec\x95\xb7`\xec\x95\xb7'
}}}
This seems to be a problem related only with string fields on recarrays,
because I'm not able to reproduce it on plain string arrays:
{{{
In [34]:s2=numpy.array([['abc']], dtype='S20')
In [35]:s2
Out[35]:
array([['abc']],
dtype='|S20')
In [36]:s2[0][0]
Out[36]:'abc'
In [37]:str(s2[0][0])
Out[37]:'abc'
}}}
Using 1.0.2.dev3546 here.
Thanks!
--
Ticket URL: <http://projects.scipy.org/scipy/numpy/ticket/483>
NumPy <http://projects.scipy.org/scipy/numpy>
The fundamental package needed for scientific computing with Python.
More information about the Numpy-tickets
mailing list