-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
BUG: DatetimeIndex.intersection gives incorrect result #42104
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
Labels
Milestone
Comments
simonjayhawkins
added a commit
to simonjayhawkins/pandas
that referenced
this issue
Jun 18, 2021
changing _can_fast_intersect to |
@simonjayhawkins @jbrockmendel: Thanks for fixing this so swiftly! |
jreback
pushed a commit
that referenced
this issue
Jun 21, 2021
meeseeksmachine
pushed a commit
to meeseeksmachine/pandas
that referenced
this issue
Jun 21, 2021
jreback
pushed a commit
that referenced
this issue
Jun 21, 2021
Co-authored-by: jbrockmendel <[email protected]>
neinkeinkaffee
pushed a commit
to neinkeinkaffee/pandas
that referenced
this issue
Jun 21, 2021
JulianWgs
pushed a commit
to JulianWgs/pandas
that referenced
this issue
Jul 3, 2021
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I have checked that this issue has not already been reported.
I have confirmed this bug exists on the latest version of pandas.
(optional) I have confirmed this bug exists on the master branch of pandas.
Note: Please read this guide detailing how to provide the necessary information for us to reproduce your bug.
Code Sample, a copy-pastable example
Problem description
The produced output is:
DatetimeIndex(['2019-06-30', '2019-12-31'], dtype='datetime64[ns]', freq='2Q-DEC')
This is clearly incorrect, as there is no overlap between the indices index[::2] and index[1::2].
The issue is related to the freq attribute, which is set to '2Q-DEC' for both index[::2] and index[1::2]. If I remove or change the freq attribute, then it works correctly.
Expected Output
DatetimeIndex([], dtype='datetime64[ns]', freq=None)
Output of
pd.show_versions()
INSTALLED VERSIONS
commit : 2cb9652
python : 3.8.5.final.0
python-bits : 64
OS : Darwin
OS-release : 20.5.0
Version : Darwin Kernel Version 20.5.0: Sat May 8 05:10:33 PDT 2021; root:xnu-7195.121.3~9/RELEASE_X86_64
machine : x86_64
processor : i386
byteorder : little
LC_ALL : en_US.UTF-8
LANG : en_US.UTF-8
LOCALE : en_US.UTF-8
pandas : 1.2.4
numpy : 1.20.3
pytz : 2021.1
dateutil : 2.8.1
pip : 21.0.1
setuptools : 52.0.0
Cython : 0.29.17
pytest : None
hypothesis : None
sphinx : None
blosc : None
feather : 0.4.1
xlsxwriter : 1.4.3
lxml.etree : 4.6.3
html5lib : None
pymysql : None
psycopg2 : 2.8.6 (dt dec pq3 ext lo64)
jinja2 : None
IPython : 7.21.0
pandas_datareader: 0.9.0
bs4 : None
bottleneck : None
fsspec : None
fastparquet : None
gcsfs : None
matplotlib : 3.3.4
numexpr : None
odfpy : None
openpyxl : 3.0.6
pandas_gbq : None
pyarrow : 3.0.0
pyxlsb : None
s3fs : None
scipy : 1.4.1
sqlalchemy : 1.3.23
tables : None
tabulate : 0.8.9
xarray : None
xlrd : None
xlwt : 1.3.0
numba : 0.52.0
The text was updated successfully, but these errors were encountered: