Skip to content

update() produces 'invalid type promotion' error when used with datetime columns and overwrite=False #9065

Closed
@Sereger13

Description

@Sereger13

xref #3025

To reproduce:

    import pandas as pd
    df = pd.DataFrame({'A': [1, 2, 3],
                       'B': ['20140101', nan, '20140101'],
                       'C': [nan, nan, nan]})
    df2 = pd.DataFrame({'A': [1, 2],
                       'B': ['20140104', '20140105'],
                       })
    df.B = pd.to_datetime(df.B, coerce=True)
    df2.B = pd.to_datetime(df2.B, coerce=True)
    df.set_index('A', inplace=True)
    df2.set_index('A', inplace=True)

    #df.update(df2[['B']]) # Works fine
    df.update(df2[['B']], overwrite=False) # Fails with 'invalid type promotion' error.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Dtype ConversionsUnexpected or buggy dtype conversionsInternalsRelated to non-user accessible pandas implementation

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions