From d067e0839ed8fe5379c180a05fc8dc98771c5602 Mon Sep 17 00:00:00 2001
From: Matthew Roeschke <10647082+mroeschke@users.noreply.github.com>
Date: Mon, 2 Dec 2024 19:49:06 -0800
Subject: [PATCH] BUG: Fix stata bug post pre-commit update (#60476)

---
 pandas/io/stata.py | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/pandas/io/stata.py b/pandas/io/stata.py
index 053e331925..34d95fb59a 100644
--- a/pandas/io/stata.py
+++ b/pandas/io/stata.py
@@ -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
 
 
-- 
GitLab