diff --git a/doc/source/release.rst b/doc/source/release.rst index 926e8f1d0c5ea..e137a93af07a9 100644 --- a/doc/source/release.rst +++ b/doc/source/release.rst @@ -531,6 +531,7 @@ Bug Fixes names weren't strings (:issue:`4956`) - A zero length series written in Fixed format not deserializing properly. (:issue:`4708`) + - Fixed decoding perf issue on pyt3 (:issue:`5441`) - Fixed bug in tslib.tz_convert(vals, tz1, tz2): it could raise IndexError exception while trying to access trans[pos + 1] (:issue:`4496`) - The ``by`` argument now works correctly with the ``layout`` argument diff --git a/pandas/io/pytables.py b/pandas/io/pytables.py index 975d04c185d51..bc2f41502614d 100644 --- a/pandas/io/pytables.py +++ b/pandas/io/pytables.py @@ -3972,8 +3972,11 @@ def _unconvert_string_array(data, nan_rep=None, encoding=None): # where the passed encoding is actually None) encoding = _ensure_encoding(encoding) if encoding is not None and len(data): - f = np.vectorize(lambda x: x.decode(encoding), otypes=[np.object]) - data = f(data) + try: + data = data.astype(str).astype(object) + except: + f = np.vectorize(lambda x: x.decode(encoding), otypes=[np.object]) + data = f(data) if nan_rep is None: nan_rep = 'nan'