From ad8ec8f49e24f5cc33406656dec88faaba9606f1 Mon Sep 17 00:00:00 2001 From: Daniel Saxton Date: Fri, 9 Oct 2020 17:43:51 -0500 Subject: [PATCH] ERR: Better error message for MultiIndex.astype --- pandas/core/indexes/multi.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pandas/core/indexes/multi.py b/pandas/core/indexes/multi.py index 0604f70316cfb..9942ac35b1c8c 100644 --- a/pandas/core/indexes/multi.py +++ b/pandas/core/indexes/multi.py @@ -3606,8 +3606,8 @@ def astype(self, dtype, copy=True): raise NotImplementedError(msg) elif not is_object_dtype(dtype): raise TypeError( - f"Setting {type(self)} dtype to anything other " - "than object is not supported" + "Setting a MultiIndex dtype to anything other than object " + "is not supported" ) elif copy is True: return self._shallow_copy()