Skip to content

BUG: isin - dtype conversions (Timestamp vs ints) #36621

Closed
@asishm

Description

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

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

  • (optional) I have confirmed this bug exists on the master branch of pandas.


related: #34125 : could be closed in favor of that if it is too much of a duplicate.

Code Sample, a copy-pastable example

import pandas as pd
s = pd.Series(pd.date_range("jan-01-2013", "jan-05-2013"))
s.isin([1356998400000000000])
>>>
0     True
1    False
2    False
3    False
4    False
dtype: bool

Problem description

Problem arises here because algos._ensure_dtype(s) returns an np.int64 array (that matches the data) and dtype=<M8[ns].

Expected Output

0    False
1    False
2    False
3    False
4    False
dtype: bool

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions