-
-
Notifications
You must be signed in to change notification settings - Fork 18.6k
BUG: date_range
inclusive
parameter behavior doesn't match interval notation when start == end
#55293
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Comments
#40245 is also related |
take |
I'm not sure whether parts of the pandas API would lead one to believe this, but from a mathematical point of view, I find this very intuitive: |
From a purely mathematical point of view |
Thanks for the correction, you're right of course. :) |
Contractually, this is a regression from earlier version
Same problem described above in version at least in 1.5.3
From the new version, code-wise it is surprising that we are only handling exclusivity for the two ends: pandas/pandas/core/arrays/datetimes.py Lines 430 to 432 in 8dab54d
The i8values will return 1 element since it satisfies the earlier function of both two-ended inclusivitypandas/pandas/core/arrays/datetimes.py Lines 2746 to 2749 in e6d0c1a
I can't think of the scenario when the timestamp is equal and we will have more than one element.. I think we should be handling exclusivity independently with
|
All this started with the poorly informed change requested in #43394
Additionally, the exact significance of the How all this could be done without breaking a lot of peoples code (again) in non-obvious ways is not clear to me. Perhaps it requires a resuscitation of the |
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
Date ranges of
(date, date]
and[date, date)
equal to[date, date]
but not(date, date)
which is unintuitive.Issue #46331 looks related to this
Expected Behavior
Installed Versions
INSTALLED VERSIONS
commit : 89bd569
python : 3.9.10.final.0
python-bits : 64
OS : Darwin
OS-release : 22.2.0
Version : Darwin Kernel Version 22.2.0: Fri Nov 11 02:03:51 PST 2022; root:xnu-8792.61.2~4/RELEASE_ARM64_T6000
machine : arm64
processor : arm
byteorder : little
LC_ALL : None
LANG : ru_RU.UTF-8
LOCALE : ru_RU.UTF-8
pandas : 2.2.0dev0+283.g89bd5695df
numpy : 1.26.0
pytz : 2021.3
dateutil : 2.8.2
setuptools : 58.1.0
pip : 21.2.4
Cython : None
pytest : None
hypothesis : None
sphinx : None
blosc : None
feather : None
xlsxwriter : None
lxml.etree : None
html5lib : None
pymysql : None
psycopg2 : None
jinja2 : 3.0.3
IPython : 8.1.1
pandas_datareader : None
bs4 : None
bottleneck : None
dataframe-api-compat: None
fastparquet : None
fsspec : None
gcsfs : None
matplotlib : 3.6.0
numba : None
numexpr : None
odfpy : None
openpyxl : 3.0.10
pandas_gbq : None
pyarrow : None
pyreadstat : None
python-calamine : None
pyxlsb : None
s3fs : None
scipy : 1.11.1
sqlalchemy : None
tables : None
tabulate : None
xarray : None
xlrd : 2.0.1
zstandard : None
tzdata : 2023.3
qtpy : None
pyqt5 : None
The text was updated successfully, but these errors were encountered: