Skip to content

Commit

Permalink
BUG: Fix stata bug post pre-commit update (#60476)
Browse files Browse the repository at this point in the history
  • Loading branch information
mroeschke authored Dec 3, 2024
1 parent d9dfaa9 commit d067e08
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions pandas/io/stata.py
Original file line number Diff line number Diff line change
Expand Up @@ -2207,14 +2207,14 @@ def _convert_datetime_to_stata_type(fmt: str) -> np.dtype:
def _maybe_convert_to_int_keys(convert_dates: dict, varlist: list[Hashable]) -> dict:
new_dict = {}
for key, value in convert_dates.items():
if not value.startswith("%"): # make sure proper fmts
if not convert_dates[key].startswith("%"): # make sure proper fmts
convert_dates[key] = "%" + value
if key in varlist:
new_dict[varlist.index(key)] = value
new_dict[varlist.index(key)] = convert_dates[key]
else:
if not isinstance(key, int):
raise ValueError("convert_dates key must be a column or an integer")
new_dict[key] = value
new_dict[key] = convert_dates[key]
return new_dict


Expand Down

0 comments on commit d067e08

Please sign in to comment.