diff --git a/pandas/io/pytables.py b/pandas/io/pytables.py index 6665ccf8ce4c5..ff66a526d3104 100644 --- a/pandas/io/pytables.py +++ b/pandas/io/pytables.py @@ -73,6 +73,14 @@ def _ensure_encoding(encoding): return encoding +def _ensure_python_type(obj): + """ Ensure that non-python types get converted to python native type + equivalents.""" + if isinstance(obj, np.generic): + return obj.item() + return obj + + Term = Expr @@ -2566,7 +2574,7 @@ def read_index_node(self, node, start=None, stop=None): name = None if 'name' in node._v_attrs: - name = node._v_attrs.name + name = _ensure_decoded(_ensure_python_type(node._v_attrs.name)) index_class = self._alias_to_class(getattr(node._v_attrs, 'index_class', ''))