-
-
Notifications
You must be signed in to change notification settings - Fork 18.8k
Description
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
import pandas as pd
pd.date_range('20230926', '20230926', inclusive='right')
# Result: DatetimeIndex(['2023-09-26'], dtype='datetime64[ns]', freq='D')
# Expected: DatetimeIndex([], dtype='datetime64[ns]', freq='D')
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
import pandas as pd
date = pd.Timestamp('20230926')
r = pd.date_range(date, date, inclusive='right')
l = pd.date_range(date, date, inclusive='left')
n = pd.date_range(date, date, inclusive='neither')
pd.testing.assert_index_equal(r, n)
pd.testing.assert_index_equal(l, n)
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