Skip to content

Commit 764b444

Browse files
committed
Merge pull request #5448 from jreback/hdf_decode
PERF: Fixed decoding perf issue on py3 (GH5441)
2 parents 90bbd6a + 1a6939f commit 764b444

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

doc/source/release.rst

+1
Original file line numberDiff line numberDiff line change
@@ -537,6 +537,7 @@ Bug Fixes
537537
names weren't strings (:issue:`4956`)
538538
- A zero length series written in Fixed format not deserializing properly.
539539
(:issue:`4708`)
540+
- Fixed decoding perf issue on pyt3 (:issue:`5441`)
540541
- Fixed bug in tslib.tz_convert(vals, tz1, tz2): it could raise IndexError
541542
exception while trying to access trans[pos + 1] (:issue:`4496`)
542543
- The ``by`` argument now works correctly with the ``layout`` argument

pandas/io/pytables.py

+5-2
Original file line numberDiff line numberDiff line change
@@ -3972,8 +3972,11 @@ def _unconvert_string_array(data, nan_rep=None, encoding=None):
39723972
# where the passed encoding is actually None)
39733973
encoding = _ensure_encoding(encoding)
39743974
if encoding is not None and len(data):
3975-
f = np.vectorize(lambda x: x.decode(encoding), otypes=[np.object])
3976-
data = f(data)
3975+
try:
3976+
data = data.astype(str).astype(object)
3977+
except:
3978+
f = np.vectorize(lambda x: x.decode(encoding), otypes=[np.object])
3979+
data = f(data)
39773980

39783981
if nan_rep is None:
39793982
nan_rep = 'nan'

0 commit comments

Comments
 (0)