Skip to content

Commit 909a3c1

Browse files
committed
Fix KeyError by adding check for _convert_dates
1 parent ca91dd4 commit 909a3c1

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

pandas/io/stata.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2611,7 +2611,7 @@ def _check_column_names(self, data: DataFrame) -> DataFrame:
26112611
# Check date conversion, and fix key if needed
26122612
if self._convert_dates:
26132613
for c, o in zip(columns, original_columns):
2614-
if c != o:
2614+
if c != o and o in self._convert_dates:
26152615
self._convert_dates[c] = self._convert_dates[o]
26162616
del self._convert_dates[o]
26172617

0 commit comments

Comments
 (0)