Skip to content

Commit 277896a

Browse files
committed
Updates from review: typing, documentation
1 parent 2796d1f commit 277896a

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

pandas/core/frame.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2470,6 +2470,8 @@ def to_stata(
24702470
to labels as values. Labels for a single variable must be 32,000
24712471
characters or smaller.
24722472
2473+
.. versionadded:: 1.3.0
2474+
24732475
Raises
24742476
------
24752477
NotImplementedError

pandas/io/stata.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -663,7 +663,9 @@ 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(zip(np.arange(len(categories)), categories))
666+
self.value_labels: list[tuple[int | float, str], ...] = list(
667+
zip(np.arange(len(categories)), categories)
668+
)
667669
self.value_labels.sort(key=lambda x: x[0])
668670

669671
self.text_len = 0
@@ -787,8 +789,9 @@ def __init__(
787789

788790
self.labname = labname
789791
self._encoding = encoding
790-
self.value_labels = list(value_labels.items())
791-
self.value_labels.sort(key=lambda x: x[0])
792+
self.value_labels: list[tuple[int | float, str], ...] = sorted(
793+
value_labels.items(), key=lambda x: x[0]
794+
)
792795

793796
self.text_len = 0
794797
self.txt: list[bytes] = []

0 commit comments

Comments
 (0)