Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
Inconsistent behaviour on empty RangeIndex intersection #14364
Description of the issue
Two empty RangeIndex objects with same starts and stops will have a non-null intersection.
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))
Actually, with pandas 0.19.0, it is even worse: first example gives an error, the second is still the wrong output:
Thanks for the report!