Skip to content

BUG: describe() doesn't show mean and quantiles for data of type INT #56846

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

Closed
2 of 3 tasks
aleksejalex opened this issue Jan 12, 2024 · 3 comments
Closed
2 of 3 tasks
Labels
Bug Nuisance Columns Identifying/Dropping nuisance columns in reductions, groupby.add, DataFrame.apply

Comments

@aleksejalex
Copy link

Pandas version checks

  • I have checked that this issue has not already been reported.

  • I have confirmed this bug exists on the latest version of pandas.

  • I have confirmed this bug exists on the main branch of pandas.

Reproducible Example

import pandas as pd

data = pd.DataFrame(columns = ['number'])

for i in [2,4,5]:
    row_data = {'number': i}
    data = pd.concat([data, pd.DataFrame([row_data])], ignore_index=True)

print(data.describe(include='all'))

Issue Description

descriibe won't count stats for INT variables

Expected Behavior

I believe previous versions did it without any problem

Installed Versions

INSTALLED VERSIONS

commit : a671b5a
python : 3.12.1.final.0
python-bits : 64
OS : Linux
OS-release : 5.15.0-91-generic
Version : #101-Ubuntu SMP Tue Nov 14 13:30:08 UTC 2023
machine : x86_64
processor : x86_64
byteorder : little
LC_ALL : None
LANG : en_US.UTF-8
LOCALE : en_US.UTF-8
pandas : 2.1.4
numpy : 1.26.3
pytz : 2023.3.post1
dateutil : 2.8.2
setuptools : None
pip : 23.3.2
Cython : None
pytest : None
hypothesis : None
sphinx : None
blosc : None
feather : None
xlsxwriter : None
lxml.etree : None
html5lib : None
pymysql : None
psycopg2 : None
jinja2 : 3.1.3
IPython : 8.20.0
pandas_datareader : None
bs4 : 4.12.2
bottleneck : None
dataframe-api-compat: None
fastparquet : None
fsspec : None
gcsfs : None
matplotlib : 3.8.2
numba : None
numexpr : None
odfpy : None
openpyxl : None
pandas_gbq : None
pyarrow : None
pyreadstat : None
pyxlsb : None
s3fs : None
scipy : 1.11.4
sqlalchemy : None
tables : None
tabulate : None
xarray : None
xlrd : None
zstandard : None
tzdata : 2023.4
qtpy : None
pyqt5 : None

@aleksejalex aleksejalex added Bug Needs Triage Issue that has not been reviewed by a pandas team member labels Jan 12, 2024
@asishm
Copy link
Contributor

asishm commented Jan 12, 2024

This is because the dtype for the number column is object (which was changed in the 2.0 release - see #29405)

So the question here is if pd.concat should try to re-infer dtypes. You can change this line data = pd.DataFrame(columns = ['number'], dtype='int64')

@aleksejalex
Copy link
Author

OK, but I need my dataframe to contains different types in different columns: INT, FLOAT, STR, and another objects.

@rhshadrach
Copy link
Member

rhshadrach commented Jan 13, 2024

@aleksejalex - thanks for the report, it sounds like you're asking how to construct a DataFrame with different column types. Please ask questions like this on StackOverflow.

If you are not getting the results you would like for data.describe(), please check the output of data.dtypes. If the dtypes are object, then this is why you're not getting mean and quantiles at it is not a bug with DataFrame.describe.

Closing.

@rhshadrach rhshadrach added Nuisance Columns Identifying/Dropping nuisance columns in reductions, groupby.add, DataFrame.apply and removed Needs Triage Issue that has not been reviewed by a pandas team member labels Jan 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Nuisance Columns Identifying/Dropping nuisance columns in reductions, groupby.add, DataFrame.apply
Projects
None yet
Development

No branches or pull requests

3 participants