Skip to content
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

DataFrame.select_dtypes include/exclude "int" not recognized. #29394

Closed
simonjayhawkins opened this issue Nov 4, 2019 · 3 comments
Closed

DataFrame.select_dtypes include/exclude "int" not recognized. #29394

simonjayhawkins opened this issue Nov 4, 2019 · 3 comments
Labels
Duplicate Report Duplicate issue or pull request

Comments

@simonjayhawkins
Copy link
Member

Code Sample, a copy-pastable example if possible

code sample from DataFrame.select_dtypes docstring

>>> import pandas as pd
>>>
>>> pd.__version__
'0.26.0.dev0+767.gb3490cbd9'
>>>
>>> df = pd.DataFrame({"a": [1, 2] * 3, "b": [True, False] * 3, "c": [1.0, 2.0] * 3})
>>> df
   a      b    c
0  1   True  1.0
1  2  False  2.0
2  1   True  1.0
3  2  False  2.0
4  1   True  1.0
5  2  False  2.0
>>>
>>> df.select_dtypes(exclude=["int"])
   a      b    c
0  1   True  1.0
1  2  False  2.0
2  1   True  1.0
3  2  False  2.0
4  1   True  1.0
5  2  False  2.0
>>>

Problem description

seen locally on master and 0.25.1

The docstring implies "int" is a valid dtype to exclude. Only "int64" produces the expected output shown in the docstring.

The same applies to the include argument.

Expected Output

>>> df.select_dtypes(exclude=["int64"])
       b    c
0   True  1.0
1  False  2.0
2   True  1.0
3  False  2.0
4   True  1.0
5  False  2.0
>>>

Output of pd.show_versions()

INSTALLED VERSIONS

commit : b3490cb
python : 3.7.5.final.0
python-bits : 64
OS : Windows
OS-release : 10
machine : AMD64
processor : Intel64 Family 6 Model 58 Stepping 9, GenuineIntel
byteorder : little
LC_ALL : None
LANG : en_GB.UTF-8
LOCALE : None.None

pandas : 0.26.0.dev0+767.gb3490cbd9
numpy : 1.17.2
pytz : 2019.3
dateutil : 2.8.0
pip : 19.3.1
setuptools : 41.6.0.post20191030
Cython : 0.29.13
pytest : 5.2.2
hypothesis : 4.36.2
sphinx : 2.2.1
blosc : None
feather : None
xlsxwriter : 1.2.2
lxml.etree : 4.4.1
html5lib : 1.0.1
pymysql : None
psycopg2 : None
jinja2 : 2.10.3
IPython : 7.9.0
pandas_datareader: None
bs4 : 4.8.1
bottleneck : 1.2.1
fastparquet : 0.3.2
gcsfs : None
lxml.etree : 4.4.1
matplotlib : 3.1.1
numexpr : 2.7.0
odfpy : None
openpyxl : 3.0.0
pandas_gbq : None
pyarrow : 0.15.1
pytables : None
s3fs : 0.3.4
scipy : 1.3.1
sqlalchemy : 1.3.10
tables : 3.5.1
xarray : 0.13.0
xlrd : 1.2.0
xlwt : 1.3.0
xlsxwriter : 1.2.2

@simonjayhawkins simonjayhawkins added the Dtype Conversions Unexpected or buggy dtype conversions label Nov 4, 2019
@pambot
Copy link
Contributor

pambot commented Nov 6, 2019

I'll take a look

@simonjayhawkins
Copy link
Member Author

I'll take a look

Thanks @pambot. as well as 'int64', the string 'integer' also works. The code sample is the last example in the docstring. https://dev.pandas.io/docs/reference/api/pandas.DataFrame.select_dtypes.html

@simonjayhawkins
Copy link
Member Author

closing as superseded by #36596

@simonjayhawkins simonjayhawkins added Duplicate Report Duplicate issue or pull request and removed Dtype Conversions Unexpected or buggy dtype conversions labels Sep 24, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Duplicate Report Duplicate issue or pull request
Projects
None yet
Development

No branches or pull requests

2 participants