We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Using sum() on a Series of Decimal datatypes returns a Decimal. However, using sum() on a DataFrame of Decimal datatypes returns floats.
sum()
I think it would be more consistent for the DataFrame sum() to return Decimals.
import pandas as pd from decimal import Decimal df = pd.DataFrame({'a':[Decimal('1.0'), Decimal('2.0')], 'b':[Decimal('3.0'), Decimal('4.0')]}) type(df['a'].sum()), type(df.sum()[0]) Out[1]: (decimal.Decimal, numpy.float64)
Out[1]: (decimal.Decimal, decimal.Decimal)
pd.show_versions()
INSTALLED VERSIONS ------------------ commit: None python: 3.5.1.final.0 python-bits: 32 OS: Windows OS-release: 7 machine: x86 processor: x86 Family 6 Model 42 Stepping 7, GenuineIntel byteorder: little LC_ALL: None LANG: None pandas: 0.18.0 nose: 1.3.7 pip: 7.1.2 setuptools: 18.5 Cython: 0.23.4 numpy: 1.10.1 scipy: 0.16.0 statsmodels: 0.6.1 xarray: None IPython: 4.0.1 sphinx: 1.3.1 patsy: 0.4.0 dateutil: 2.4.2 pytz: 2015.7 blosc: None bottleneck: 1.0.0 tables: 3.2.2 numexpr: 2.5 matplotlib: 1.5.0 openpyxl: 2.2.6 xlrd: 0.9.4 xlwt: 1.0.0 xlsxwriter: 0.7.7 lxml: 3.4.4 bs4: 4.4.1 html5lib: 0.999 httplib2: None apiclient: None sqlalchemy: 1.0.9 pymysql: None psycopg2: None jinja2: 2.8 boto: 2.38.0
The text was updated successfully, but these errors were encountered:
Decimal is not a first class type, nor will it likely be going forward. So this is unsupported.
Decimal
xref #13157 (and other issues if you want to look)
Sorry, something went wrong.
Understood and thanks for the quick response and helpful xrefs
No branches or pull requests
Using
sum()
on a Series of Decimal datatypes returns a Decimal. However, usingsum()
on a DataFrame of Decimal datatypes returns floats.I think it would be more consistent for the DataFrame
sum()
to return Decimals.Code Sample
Expected Output
output of
pd.show_versions()
The text was updated successfully, but these errors were encountered: