Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading