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
I have checked that this issue has not already been reported.
I have confirmed this bug exists on the latest version of pandas.
I have confirmed this bug exists on the main branch of pandas.
In [52]: import pandas as pd ...: dti = pd.date_range(start="2020-01-31", freq="1min", periods=6000) ...: df = pd.DataFrame({'ts': dti}, index=dti) ...: grouped = df.resample('D', closed='right') ...: grouped.last() Out[52]: ts 2020-01-30 2020-01-31 00:00:00 2020-01-31 2020-02-01 00:00:00 2020-02-01 2020-02-02 00:00:00 2020-02-02 2020-02-03 00:00:00 2020-02-03 2020-02-04 00:00:00 2020-02-04 2020-02-04 03:59:00 In [53]: import pandas as pd ...: dti = pd.date_range(start="2020-01-31", freq="1min", periods=6000) ...: df = pd.DataFrame({'ts': dti}, index=dti) ...: grouped = df.resample('B', closed='right') ...: grouped.last() Out[53]: ts 2020-01-30 2020-01-31 23:59:00 2020-01-31 2020-02-03 23:59:00 2020-02-03 2020-02-04 03:59:00
In the above, 'D' ('day'), the last point is at midnight of the following day
But for 'B', it's one minute before midnight of the following day
This is due to this 11-year-old hack
7fb453a
For the second one, I think:
ts 2020-01-30 2020-01-31 00:00:00 2020-01-31 2020-02-03 00:00:00 2020-02-03 2020-02-04 00:00:00
commit : e86ed37 python : 3.10.12.final.0 python-bits : 64 OS : Linux OS-release : 5.10.102.1-microsoft-standard-WSL2 Version : #1 SMP Wed Mar 2 00:30:59 UTC 2022 machine : x86_64 processor : x86_64 byteorder : little LC_ALL : None LANG : en_GB.UTF-8 LOCALE : en_GB.UTF-8
pandas : 2.1.1 numpy : 1.25.1 pytz : 2023.3 dateutil : 2.8.2 setuptools : 67.6.1 pip : 23.1.2 Cython : None pytest : 7.3.1 hypothesis : 6.82.4 sphinx : None blosc : None feather : None xlsxwriter : None lxml.etree : None html5lib : None pymysql : None psycopg2 : None jinja2 : 3.1.2 IPython : 8.13.2 pandas_datareader : None bs4 : 4.12.2 bottleneck : None dataframe-api-compat: None fastparquet : 2023.7.0 fsspec : 2023.6.0 gcsfs : None matplotlib : 3.7.1 numba : None numexpr : None odfpy : None openpyxl : None pandas_gbq : None pyarrow : 12.0.1 pyreadstat : None pyxlsb : None s3fs : None scipy : 1.11.0 sqlalchemy : 2.0.20 tables : None tabulate : None xarray : None xlrd : None zstandard : None tzdata : 2023.3 qtpy : None pyqt5 : None None
The text was updated successfully, but these errors were encountered:
Successfully merging a pull request may close this issue.
Pandas version checks
I have checked that this issue has not already been reported.
I have confirmed this bug exists on the latest version of pandas.
I have confirmed this bug exists on the main branch of pandas.
Reproducible Example
Issue Description
In the above, 'D' ('day'), the last point is at midnight of the following day
But for 'B', it's one minute before midnight of the following day
This is due to this 11-year-old hack
7fb453a
Expected Behavior
For the second one, I think:
Installed Versions
INSTALLED VERSIONS
commit : e86ed37
python : 3.10.12.final.0
python-bits : 64
OS : Linux
OS-release : 5.10.102.1-microsoft-standard-WSL2
Version : #1 SMP Wed Mar 2 00:30:59 UTC 2022
machine : x86_64
processor : x86_64
byteorder : little
LC_ALL : None
LANG : en_GB.UTF-8
LOCALE : en_GB.UTF-8
pandas : 2.1.1
numpy : 1.25.1
pytz : 2023.3
dateutil : 2.8.2
setuptools : 67.6.1
pip : 23.1.2
Cython : None
pytest : 7.3.1
hypothesis : 6.82.4
sphinx : None
blosc : None
feather : None
xlsxwriter : None
lxml.etree : None
html5lib : None
pymysql : None
psycopg2 : None
jinja2 : 3.1.2
IPython : 8.13.2
pandas_datareader : None
bs4 : 4.12.2
bottleneck : None
dataframe-api-compat: None
fastparquet : 2023.7.0
fsspec : 2023.6.0
gcsfs : None
matplotlib : 3.7.1
numba : None
numexpr : None
odfpy : None
openpyxl : None
pandas_gbq : None
pyarrow : 12.0.1
pyreadstat : None
pyxlsb : None
s3fs : None
scipy : 1.11.0
sqlalchemy : 2.0.20
tables : None
tabulate : None
xarray : None
xlrd : None
zstandard : None
tzdata : 2023.3
qtpy : None
pyqt5 : None
None
The text was updated successfully, but these errors were encountered: