A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/pandas-dev/pandas/issues/14364 below:

Inconsistent behaviour on empty RangeIndex intersection · Issue #14364 · pandas-dev/pandas · GitHub

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


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4