diff --git a/pandas/io/pytables.py b/pandas/io/pytables.py index b838260d1f73c..e47265176aeff 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 @@ -2567,7 +2575,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', ''))