-
-
Notifications
You must be signed in to change notification settings - Fork 19.1k
DEPR: back-compat shim for select_dtypes #62718
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
base: main
Are you sure you want to change the base?
DEPR: back-compat shim for select_dtypes #62718
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good!
pandas/core/frame.py
Outdated
# GH#61916 | ||
warnings.warn( | ||
"For backward compatibility, 'str' dtypes are included by " | ||
"select_dtypes when object dtypes are specified. " |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"select_dtypes when object dtypes are specified. " | |
"select_dtypes when 'object' dtype is specified. " |
To select string columns include ``str``: | ||
|
||
.. ipython:: python | ||
df.select_dtypes(include=["object"]) | ||
df.select_dtypes(include=[str]) | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would maybe add a note that this changed in pandas 3.0 and that for pandas<3, include="object"
was used. Maybe with a link to https://pandas.pydata.org/docs/user_guide/migration-3-strings.html#hardcoded-use-of-object-dtype
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good idea, updated.
select_dtypes
#61916 (Replace xxxx with the GitHub issue number)doc/source/whatsnew/vX.X.X.rst
file if fixing a bug or adding a new feature.cc @jorisvandenbossche