-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
DataFrameGroupby.resample with the on
keyword does not produce the same output as on DateTimeIndex
#27343
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
Comments
we just updated the doc-string here: https://dev.pandas.io/reference/api/pandas.DataFrame.rolling.html?highlight=rolling#pandas.DataFrame.rolling .resample could be the same |
I see the difference in .rolling()
but I am not sure what it means here, I am grouping on an object (string) column |
Added to the initial example that |
I saw the issue has been labelled [Docs], but from the outside I still believes it is a Bug That is the initial frame. (Below, compared to my initial example I changed the rule from
the output from
But the output of
|
I think I ended up with the same bug. You can find an additional example here: https://repl.it/@valkum/SoulfulFrequentBooleanlogic#main.py |
Code Sample, a copy-pastable example if possible
Problem description
DataFrameGroupby.resample with the
on
keyword (last line) produces an incorrect output: it differs from the output produce with a DateTimeIndex and has incorrect values. It seems that it does not handle the group properly:('a', 2012-12-31 00:00:00):1
that is incorrectref =='a'
only starts in 2014 so not only should there be no entry but value of 1 is incorrectref == 'b'
has a min time entry in 2015 so there should not be any entry before that regardless of its valueExpected Output
True
forpd.DataFrame.equals(df.groupby("ref").resample(rule='M', on='time')['value'].sum(), df.set_index('time').groupby("ref").resample(rule='M')['value'].sum())
Output of
pd.show_versions()
[paste the output of
pd.show_versions()
here below this line]INSTALLED VERSIONS
commit: None
python: 3.7.3.final.0
python-bits: 64
OS: Darwin
OS-release: 18.6.0
machine: x86_64
processor: i386
byteorder: little
LC_ALL: None
LANG: en_CA.UTF-8
LOCALE: en_CA.UTF-8
pandas: 0.24.2
pytest: None
pip: 19.1.1
setuptools: 41.0.1
Cython: None
numpy: 1.16.4
scipy: None
pyarrow: None
xarray: None
IPython: 7.6.1
sphinx: None
patsy: None
dateutil: 2.8.0
pytz: 2019.1
blosc: None
bottleneck: None
tables: None
numexpr: None
feather: None
matplotlib: None
openpyxl: None
xlrd: None
xlwt: None
xlsxwriter: None
lxml.etree: None
bs4: None
html5lib: None
sqlalchemy: None
pymysql: None
psycopg2: None
jinja2: 2.10.1
s3fs: None
fastparquet: None
pandas_gbq: None
pandas_datareader: None
gcsfs: None
The text was updated successfully, but these errors were encountered: