Skip to content

ENH: tolerance for Float64Index including join / reindex-nearest #9817

Open
@hsuominen

Description

@hsuominen

When trying to intersect two Index objects containing floats I get the following unexpected behavior:

>>> new_index = pd.Index(np.arange(0.0,1.0,0.1),dtype='float64')
>>> new_index2 = pd.Index(np.arange(0.5,1.0,0.1),dtype='float64')
>>> intersection = new_index.intersection(new_index2)
Float64Index([0.0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9], dtype='float64')
Float64Index([0.5, 0.6, 0.7, 0.8, 0.9], dtype='float64')
Float64Index([0.5], dtype='float64')

Where I would expect the intersection to equal index2.

Pandas version string below:

INSTALLED VERSIONS

commit: None
python: 2.7.9.final.0
python-bits: 64
OS: Linux
OS-release: 3.13.0-45-generic
machine: x86_64
processor: x86_64
byteorder: little
LC_ALL: None
LANG: en_US.UTF-8

pandas: 0.16.0
nose: 1.3.4
Cython: 0.21.2
numpy: 1.9.2
scipy: 0.15.1
statsmodels: None
IPython: 2.4.1
sphinx: None
patsy: None
dateutil: 2.4.2
pytz: 2015.2
bottleneck: None
tables: None
numexpr: None
matplotlib: 1.4.3
openpyxl: None
xlrd: None
xlwt: None
xlsxwriter: None
lxml: None
bs4: None
html5lib: None
httplib2: None
apiclient: None
sqlalchemy: None
pymysql: None
psycopg2: None

Metadata

Metadata

Assignees

No one assigned

    Labels

    Dtype ConversionsUnexpected or buggy dtype conversionsEnhancementIndexRelated to the Index class or subclasses

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions