Closed
Description
Description of the issue
Two empty RangeIndex objects with same starts and stops will have a non-null intersection.
Code example
import pandas as pd
# Two empty rangeindexes
a = pd.RangeIndex(0, 0)
b = pd.RangeIndex(0, 0)
# Also empty but different start and stops
c = pd.RangeIndex(1, 1)
# OK, this returns an empty Index
print(a.intersection(c))
# Strangely, this one returns an index of [0, 1[
print(a.intersection(b))
Expected output
RangeIndex(start=0, stop=0, step=1)
RangeIndex(start=0, stop=0, step=1)
Output
RangeIndex(start=0, stop=0, step=1)
RangeIndex(start=0, stop=1, step=1)
Output of pd.show_versions()
Not the most recent version of Pandas, but I believe this behaviour is still present in the master branch
after browsing the code. If somebody could confirm.
## INSTALLED VERSIONS
commit: None
python: 2.7.10.final.0
python-bits: 64
OS: Linux
OS-release: None
machine: x86_64
processor: x86_64
byteorder: little
LC_ALL: None
LANG: en_US.UTF-8
pandas: 0.18.1
setuptools: 24.0.2
numpy: 1.10.1
dateutil: 1.5
pytz: 2015.4