Skip to content

BUG: .isin on datetimelike indexes do not validate input of level parameter  #26675

Closed
@simonjayhawkins

Description

@simonjayhawkins

Code Sample, a copy-pastable example if possible

index = pd.DatetimeIndex([], name='foo')
index.isin([], level='foobar')

Problem description

on master:

array([], dtype=bool)

on 0.23.4

---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
<ipython-input-2-82f8aeda6721> in <module>
      1 index = pd.DatetimeIndex([], name='foo')
----> 2 index.isin([], level='foobar')

TypeError: isin() got an unexpected keyword argument 'level'

Expected Output

to validate input and raise same message as other non-datetimelike indexes

KeyError: 'Level foobar must be same as name (foo)'

the api for isin is defined in #7892

Output of pd.show_versions()

[paste the output of pd.show_versions() here below this line]

Metadata

Metadata

Assignees

No one assigned

    Labels

    DatetimeDatetime data dtypeIndexRelated to the Index class or subclasses

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions