We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent e5ab629 commit 029c180Copy full SHA for 029c180
pandas/core/algorithms.py
@@ -931,7 +931,7 @@ def value_counts_internal(
931
# For backwards compatibility, we let Index do its normal type
932
# inference, _except_ for if if infers from object to bool.
933
idx = Index(keys)
934
- if idx.dtype == bool and keys.dtype == object:
+ if idx.dtype in [bool, "string"] and keys.dtype == object:
935
idx = idx.astype(object)
936
elif (
937
idx.dtype != keys.dtype # noqa: PLR1714 # # pylint: disable=R1714
0 commit comments