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
date_index = pd.date_range("2019-08-26", "2019-09-20") sessions = DataFrame(range(1, len(dates) + 1), index=date_index, columns=['foo']) sessions.groupby(pd.Grouper(freq=pd.Timedelta(weeks=4), key='created_at', loffset='4W')).size()
The above use of loffset does not change the grouping labels as expected. The corresponding code using DataFrame.resample does work. Try:
loffset
DataFrame.resample
sessions.resample(pd.Timedelta(weeks=4), on='created_at', loffset='4W')
created_at 2019-09-22 1048 2019-10-20 904 Freq: 28D, dtype: int64
created_at 2019-08-26 1048 2019-09-23 904 Freq: 28D, dtype: int64
pd.show_versions()
commit : None python : 3.6.4.final.0 python-bits : 64 OS : Darwin OS-release : 18.6.0 machine : x86_64 processor : i386 byteorder : little LC_ALL : None LANG : en_GB.UTF-8 LOCALE : en_GB.UTF-8
pandas : 0.25.2 numpy : 1.16.2 pytz : 2018.9 dateutil : 2.8.0 pip : 9.0.1 setuptools : 28.8.0 Cython : None pytest : 4.6.5 hypothesis : None sphinx : None blosc : None feather : None xlsxwriter : 1.1.1 lxml.etree : 4.3.2 html5lib : None pymysql : 0.9.3 psycopg2 : None jinja2 : 2.10 IPython : 7.5.0 pandas_datareader: None bs4 : None bottleneck : None fastparquet : None gcsfs : None lxml.etree : 4.3.2 matplotlib : 3.0.0 numexpr : None odfpy : None openpyxl : None pandas_gbq : None pyarrow : None pytables : None s3fs : None scipy : 1.2.1 sqlalchemy : 1.2.12 tables : None xarray : None xlrd : 1.2.0 xlwt : None xlsxwriter : 1.1.1
The text was updated successfully, but these errors were encountered:
Seems to be the same as #28302
Sorry, something went wrong.
Closing as a duplicate of #28302
No branches or pull requests
Code Sample
Problem description
The above use of
loffset
does not change the grouping labels as expected. The corresponding code usingDataFrame.resample
does work. Try:Expected Output
Actual Output
Output of
pd.show_versions()
INSTALLED VERSIONS
commit : None
python : 3.6.4.final.0
python-bits : 64
OS : Darwin
OS-release : 18.6.0
machine : x86_64
processor : i386
byteorder : little
LC_ALL : None
LANG : en_GB.UTF-8
LOCALE : en_GB.UTF-8
pandas : 0.25.2
numpy : 1.16.2
pytz : 2018.9
dateutil : 2.8.0
pip : 9.0.1
setuptools : 28.8.0
Cython : None
pytest : 4.6.5
hypothesis : None
sphinx : None
blosc : None
feather : None
xlsxwriter : 1.1.1
lxml.etree : 4.3.2
html5lib : None
pymysql : 0.9.3
psycopg2 : None
jinja2 : 2.10
IPython : 7.5.0
pandas_datareader: None
bs4 : None
bottleneck : None
fastparquet : None
gcsfs : None
lxml.etree : 4.3.2
matplotlib : 3.0.0
numexpr : None
odfpy : None
openpyxl : None
pandas_gbq : None
pyarrow : None
pytables : None
s3fs : None
scipy : 1.2.1
sqlalchemy : 1.2.12
tables : None
xarray : None
xlrd : 1.2.0
xlwt : None
xlsxwriter : 1.1.1
The text was updated successfully, but these errors were encountered: