Skip to content

Commit 06dd5da

Browse files
authored
ENH: Make categories setitem error more readable (#48087)
1 parent d9e2fb5 commit 06dd5da

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

pandas/core/arrays/categorical.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1588,7 +1588,7 @@ def _validate_scalar(self, fill_value):
15881588
raise TypeError(
15891589
"Cannot setitem on a Categorical with a new "
15901590
f"category ({fill_value}), set the categories first"
1591-
)
1591+
) from None
15921592
return fill_value
15931593

15941594
# -------------------------------------------------------------

0 commit comments

Comments
 (0)