Skip to content

Conversation

shrutisachan08
Copy link

@shrutisachan08 shrutisachan08 commented Aug 16, 2025

Description

This PR updates the is_scalar docstring to clarify that Enum members are treated as scalars, addressing the confusion reported in #62063.

The is_scalar function already correctly treats Enum members as scalars (via isinstance(val, Enum) in the implementation), but the documentation was unclear about this behavior, leading to confusion for users and type checkers.

Changes Made

  • Updated the docstring to clearly explain the exclusion rule: only list, tuple, numpy.ndarray, and pandas Series are considered non-scalar
  • Added explicit mention of "Enum members" in the list of scalar types
  • Added a practical Enum example in the Examples section

Checklist

- Updated docstring to explain exclusion rule clearly
- Added Enum example to documentation
The docstring now clearly states that anything except list, tuple,
numpy.ndarray, and pandas Series is treated as scalar, including
Enum members.
Fixes pandas-dev#62063
@shrutisachan08
Copy link
Author

pre-commit.ci autofix

@jbrockmendel
Copy link
Member

This looks like AI. Please don’t do that.

@shrutisachan08
Copy link
Author

@jbrockmendel May I please know which section you are referring to .

@mroeschke
Copy link
Member

Agreed, closing as it appears this is AI generated

@mroeschke mroeschke closed this Aug 17, 2025
@shrutisachan08 shrutisachan08 deleted the fix-enum-is-scalar-docs branch August 17, 2025 19:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

BUG: is_scalar(Enum) gives False

3 participants