Skip to content

Missing check if the renamed column is listed under self._convert_dates() before referring to it leads to a KeyError. #60536

Open
@seppliv

Description

@seppliv

When checking and fixing column names for writing a Stata file, there is an added check to see whether the renamed column also needs to be renamed under the _convert_dates class attribute (a dict). However, there is a missing condition to see if the renamed column name is actually listed under the _convert_dates dict, and so it raises KeyError every time such variable name is not found in the dict keys. A simple condition such as that below would probably do the trick:
if c != o and o in self._convert_dates:

if c != o:

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions