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 resample and Grouper ,Why are the results different? #28331

Open
CrystalWindSnake opened this issue Sep 7, 2019 · 1 comment
Open
Labels
Bug Groupby Reshaping Concat, Merge/Join, Stack/Unstack, Explode

Comments

@CrystalWindSnake
Copy link

Code Sample, a copy-pastable example if possible

data:

idx = pd.date_range('2017-1-1','2018-12-31',freq='M')
df = pd.DataFrame(np.arange(len(idx)),idx)

resample:

df.resample('3m',kind='period').sum()

use grouper:

df.groupby(pd.Grouper(level=0,freq='3m',kind='period')).sum()

Problem description

Why are the results different?

Expected Output

I hope that the result of using the grouper is the same as the resample method.

thank you!!

Output of pd.show_versions()

INSTALLED VERSIONS

commit : None
python : 3.7.3.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 : None
LOCALE : None.None

pandas : 0.25.0
numpy : 1.16.2
pytz : 2018.9
dateutil : 2.8.0
pip : 19.0.3
setuptools : 40.8.0
Cython : 0.29.6
pytest : 4.3.1
hypothesis : None
sphinx : 1.8.5
blosc : None
feather : 0.4.0
xlsxwriter : 1.1.5
lxml.etree : 4.3.2
html5lib : 1.0.1
pymysql : None
psycopg2 : None
jinja2 : 2.10
IPython : 7.4.0
pandas_datareader: None
bs4 : 4.7.1
bottleneck : 1.2.1
fastparquet : None
gcsfs : None
lxml.etree : 4.3.2
matplotlib : 3.0.3
numexpr : 2.6.9
odfpy : None
openpyxl : 2.6.1
pandas_gbq : None
pyarrow : 0.13.0
pytables : None
s3fs : None
scipy : 1.2.1
sqlalchemy : 1.3.1
tables : 3.5.1
xarray : None
xlrd : 1.2.0
xlwt : 1.3.0
xlsxwriter : 1.1.5

@WillAyd
Copy link
Member

WillAyd commented Sep 7, 2019

This is probably related to #28302 if you'd like to investigate and submit a PR I think would certainly be welcome

@WillAyd WillAyd added Groupby Reshaping Concat, Merge/Join, Stack/Unstack, Explode labels Sep 7, 2019
@WillAyd WillAyd modified the milestones: 2.0, Contributions Welcome Sep 7, 2019
@mroeschke mroeschke added the Bug label Jul 11, 2021
@mroeschke mroeschke removed this from the Contributions Welcome milestone Oct 13, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Groupby Reshaping Concat, Merge/Join, Stack/Unstack, Explode
Projects
None yet
Development

No branches or pull requests

3 participants