Skip to content

BUG: Intersection of Pandas Index Object is not working properly #61831

Closed
@Abhinav2615

Description

@Abhinav2615

Pandas version checks

  • I have checked that this issue has not already been reported.

  • I have confirmed this bug exists on the latest version of pandas.

  • I have confirmed this bug exists on the main branch of pandas.

Reproducible Example

import pandas as pd
indA=pd.Index([1,3,5,7,9])
indB=pd.Index([2,3,5,7,11])

indA & indB

Issue Description

the output i am getting is :
Index([0, 3, 5, 7, 9], dtype='int64')

Expected Behavior

but after intersection, i should get the output:
Index([3, 5, 7], dtype='int64')

Installed Versions

Replace this line with the output of pd.show_versions()

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugNeeds TriageIssue that has not been reviewed by a pandas team member

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions