Skip to content

DOC: update .str.contains/match/startswith docstring examples for default behaviour #61960

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Conversation

jorisvandenbossche
Copy link
Member

Updating the docstrings of .str. predicate methods that have the na keyword.

For the examples, the current text is no longer correct (because the default behaviour with str dtype is now to already return False).
For now I just removed those examples. I could instead update the example to create an object-dtype Series to still show the na behaviour, but personally I feel that would make the docstring examples more complex than needed, and that it is fine to let they focus on just the default dtype. But no strong opinion ;)

@jorisvandenbossche jorisvandenbossche added Docs Strings String extension data type and string data labels Jul 26, 2025
@jorisvandenbossche jorisvandenbossche added this to the 3.0 milestone Jul 26, 2025
Comment on lines -1245 to +1247
array. For object-dtype, ``numpy.nan`` is used. For the nullable
``StringDtype``, ``pandas.NA`` is used. For the ``"str"`` dtype,
``False`` is used.
array. For the ``"str"`` dtype, ``False`` is used. For object
dtype, ``numpy.nan`` is used. For the nullable ``StringDtype``,
``pandas.NA`` is used.
Copy link
Member Author

Choose a reason for hiding this comment

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

Here I am just changing the order to list the default str dtype first

@mroeschke mroeschke merged commit 5e2fcb9 into pandas-dev:main Jul 28, 2025
49 checks passed
@mroeschke
Copy link
Member

Thanks @jorisvandenbossche

@jorisvandenbossche jorisvandenbossche deleted the string-dtype-docstring-str-contains-na branch July 30, 2025 09:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Docs Strings String extension data type and string data
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants