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
[ X] I have checked that this issue has not already been reported.
[ all versions] I have confirmed this bug exists on the latest version of pandas.
(optional) I have confirmed this bug exists on the master branch of pandas.
Note: Please read this guide detailing how to provide the necessary information for us to reproduce your bug.
import pandas as pd import numpy as np data = pd.DataFrame({ 'cat': ['cat_1', 'cat_1', 'cat_2', 'cat_1', 'cat_2', 'cat_1', 'cat_2', 'cat_1'], 'num': [5,20,22,3,4,30,10,50], 'date': ['2019-2-1', '2018-02-03','2020-3-11','2019-2-2', '2019-2-2', '2018-12-4','2020-3-11', '2020-12-12'] }) data['date'] = pd.to_datetime(data['date']) aggreg = data.groupby('cat').resample('Y', on='date') summ_ = aggreg.sum() agg_summ_ = aggreg.agg({'num': 'sum'}) summ_ agg_summ_
When I want aggregate all columns by sum, example with summ_ calculates normal, but if I do example with agg it calculates incorrect.
summ_
pd.show_versions()
pandas : 1.1.0 numpy : 1.18.4 pytz : 2019.3 dateutil : 2.8.0 pip : 20.0.2 setuptools : 41.4.0 Cython : 0.29.13 pytest : 5.2.1 hypothesis : None sphinx : 2.2.0 blosc : None feather : None xlsxwriter : 1.2.1 lxml.etree : 4.4.1 html5lib : 1.0.1 pymysql : 0.9.3 psycopg2 : None jinja2 : 2.11.2 IPython : 7.8.0 pandas_datareader: None bs4 : 4.8.0 bottleneck : 1.2.1 fsspec : 0.5.2 fastparquet : None gcsfs : None matplotlib : 3.2.1 numexpr : 2.7.0 odfpy : None openpyxl : 3.0.0 pandas_gbq : None pyarrow : None pytables : None pyxlsb : None s3fs : None scipy : 1.4.1 sqlalchemy : 1.3.9 tables : 3.5.2 tabulate : 0.8.7 xarray : 0.16.0 xlrd : 1.2.0 xlwt : 1.3.0 numba : 0.45.1
The text was updated successfully, but these errors were encountered:
pls show an actually reproducible example ; construct the input with code and show the results and what is not correct
Sorry, something went wrong.
Done
Looks like a dupe of #33548.
closing as duplicate
No branches or pull requests
[ X] I have checked that this issue has not already been reported.
[ all versions] I have confirmed this bug exists on the latest version of pandas.
(optional) I have confirmed this bug exists on the master branch of pandas.
Note: Please read this guide detailing how to provide the necessary information for us to reproduce your bug.
Code Sample, a copy-pastable example
Problem description
When I want aggregate all columns by sum, example with summ_ calculates normal, but if I do example with agg it calculates incorrect.
Expected Output
summ_
Output of
pd.show_versions()
pandas : 1.1.0
numpy : 1.18.4
pytz : 2019.3
dateutil : 2.8.0
pip : 20.0.2
setuptools : 41.4.0
Cython : 0.29.13
pytest : 5.2.1
hypothesis : None
sphinx : 2.2.0
blosc : None
feather : None
xlsxwriter : 1.2.1
lxml.etree : 4.4.1
html5lib : 1.0.1
pymysql : 0.9.3
psycopg2 : None
jinja2 : 2.11.2
IPython : 7.8.0
pandas_datareader: None
bs4 : 4.8.0
bottleneck : 1.2.1
fsspec : 0.5.2
fastparquet : None
gcsfs : None
matplotlib : 3.2.1
numexpr : 2.7.0
odfpy : None
openpyxl : 3.0.0
pandas_gbq : None
pyarrow : None
pytables : None
pyxlsb : None
s3fs : None
scipy : 1.4.1
sqlalchemy : 1.3.9
tables : 3.5.2
tabulate : 0.8.7
xarray : 0.16.0
xlrd : 1.2.0
xlwt : 1.3.0
numba : 0.45.1
The text was updated successfully, but these errors were encountered: