Skip to content

Conversation

Aniketsy
Copy link
Contributor

(GH#62063)
This PR updates the docstring for is_scalar to better reflect its actual behavior in pandas.

Clearly differentiates between values considered scalars and values treated as non-scalars.

Explicitly documents that the following are treated as non-scalars
np.ndarray, list , tuple , pandas.Series.

Please let me know if this fix needs any improvements . I’m open to feedback and happy to make changes based on suggestions.
Thankyou!

@Aniketsy
Copy link
Contributor Author

Hi @rhshadrach, as per your suggestion on the issue, I’ve applied the changes. Could you please take a look and let me know if this correctly states and enhances the doc for the issue?
I’m happy to make further adjustments based on your feedback.

Copy link
Member

@rhshadrach rhshadrach left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR! I think I wasn't clear in #62063 (comment), that comment is recommending to change Series.eq documentation.

Comment on lines 224 to 225
>>> pd.api.types.is_scalar(Thing.one)
True
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is incorrect - the result here is False.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thankyou , for correcting me . I will fix this

@@ -175,6 +175,13 @@ def is_scalar(val: object) -> bool:
- DateOffset
- Fraction
- Number.
- Any other non-sequence objects (e.g. Enum members, custom objects)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is incorrect, most non-sequence objects will return False here.

@Aniketsy Aniketsy force-pushed the doc/is_scalar-docstring-clarification-clean branch from b6754ff to 50ef24a Compare August 24, 2025 20:24
@Aniketsy
Copy link
Contributor Author

I apologize for the inconvenience with this PR. I’ll update the changes and open a new PR for this.

@Aniketsy Aniketsy closed this Aug 24, 2025
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.

2 participants