Skip to content

Commit c2b8a26

Browse files
REF: Simplify StringDtype check to allow fallthrough
1 parent 37a3e8e commit c2b8a26

File tree

1 file changed

+6
-8
lines changed

1 file changed

+6
-8
lines changed

pandas/io/pytables.py

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3147,14 +3147,12 @@ def write_multi_index(self, key: str, index: MultiIndex) -> None:
31473147
zip(index.levels, index.codes, index.names, strict=True)
31483148
):
31493149
# write the level
3150-
if isinstance(lev.dtype, ExtensionDtype):
3151-
# GH 63412
3152-
if isinstance(lev.dtype, StringDtype):
3153-
pass
3154-
else:
3155-
raise NotImplementedError(
3156-
"Saving a MultiIndex with an extension dtype is not supported."
3157-
)
3150+
if isinstance(lev.dtype, ExtensionDtype) and not isinstance(
3151+
lev.dtype, StringDtype
3152+
):
3153+
raise NotImplementedError(
3154+
"Saving a MultiIndex with an extension dtype is not supported."
3155+
)
31583156
level_key = f"{key}_level{i}"
31593157
conv_level = _convert_index(level_key, lev, self.encoding, self.errors)
31603158
self.write_array(level_key, conv_level.values)

0 commit comments

Comments
 (0)