Skip to content

REGRESSION: Merging on vectors looks broken #19038

Closed
@gfyoung

Description

@gfyoung

Here is the code:

import pandas as pd

df = pd.DataFrame([1, 2, 3], ['2016-01-01', '2017-01-01', '2018-01-01'], columns=['a'])
df.index = pd.to_datetime(df.index)

df.merge(df, on=['a', df.index.year])

This works in v0.19.0, but in v0.22.0 fails with:

KeyError: "Int64Index([2016, 2017, 2018], dtype='int64') not in index"

In v0.19.0, the merge produces a result (not sure if I agree with it though):

  a key_1
0 1 2016
1 2 2017
2 3 2018

Metadata

Metadata

Assignees

No one assigned

    Labels

    RegressionFunctionality that used to work in a prior pandas versionReshapingConcat, Merge/Join, Stack/Unstack, Explode

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions