mirror of
https://github.com/p2p-ld/numpydantic.git
synced 2025-01-09 21:44:27 +00:00
correct decoding of byte arrays
This commit is contained in:
parent
e78c170a2b
commit
5e154ce21e
1 changed files with 4 additions and 1 deletions
|
@ -131,9 +131,12 @@ class H5Proxy:
|
||||||
item = (item, self.field)
|
item = (item, self.field)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
# single string
|
||||||
return obj[item].decode(encoding.encoding)
|
return obj[item].decode(encoding.encoding)
|
||||||
except AttributeError:
|
except AttributeError:
|
||||||
return np.strings.decode(obj[item], encoding=encoding.encoding)
|
# numpy array of bytes
|
||||||
|
return np.char.decode(obj[item], encoding=encoding.encoding)
|
||||||
|
|
||||||
else:
|
else:
|
||||||
obj = obj.fields(self.field)
|
obj = obj.fields(self.field)
|
||||||
else:
|
else:
|
||||||
|
|
Loading…
Reference in a new issue