Skip to content

Commit c31034d

Browse files
committed
Fixing mypy errors
1 parent 277896a commit c31034d

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

pandas/io/stata.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -663,7 +663,7 @@ def __init__(self, catarray: Series, encoding: str = "latin-1"):
663663
self.labname = catarray.name
664664
self._encoding = encoding
665665
categories = catarray.cat.categories
666-
self.value_labels: list[tuple[int | float, str], ...] = list(
666+
self.value_labels: list[tuple[int | float, str]] = list(
667667
zip(np.arange(len(categories)), categories)
668668
)
669669
self.value_labels.sort(key=lambda x: x[0])
@@ -681,9 +681,9 @@ def _prepare_value_labels(self):
681681
""" Encode value labels. """
682682
# Compute lengths and setup lists of offsets and labels
683683
offsets: list[int] = []
684-
values: list[int] = []
684+
values: list[int | float] = []
685685
for vl in self.value_labels:
686-
category = vl[1]
686+
category: str | bytes = vl[1]
687687
if not isinstance(category, str):
688688
category = str(category)
689689
warnings.warn(
@@ -789,7 +789,7 @@ def __init__(
789789

790790
self.labname = labname
791791
self._encoding = encoding
792-
self.value_labels: list[tuple[int | float, str], ...] = sorted(
792+
self.value_labels: list[tuple[int | float, str]] = sorted(
793793
value_labels.items(), key=lambda x: x[0]
794794
)
795795

@@ -2337,7 +2337,7 @@ def _prepare_non_cat_value_labels(self, data: DataFrame) -> None:
23372337
if labname in self._converted_names:
23382338
colname = self._converted_names[labname]
23392339
elif labname in data.columns:
2340-
colname = labname
2340+
colname = str(labname)
23412341
else:
23422342
raise KeyError(
23432343
f"Can't create value labels for {labname}, it wasn't "

0 commit comments

Comments
 (0)