From eabce9f3335d2091451f5d8f709451a97e262c33 Mon Sep 17 00:00:00 2001 From: Kevin Sheppard Date: Fri, 17 Jan 2020 13:08:28 +0000 Subject: [PATCH] CLN: Add additional typing information --- pandas/io/stata.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/pandas/io/stata.py b/pandas/io/stata.py index 43af5eab92d74d..053b163525cd13 100644 --- a/pandas/io/stata.py +++ b/pandas/io/stata.py @@ -588,10 +588,10 @@ def __init__(self, catarray: Series, encoding: str = "latin-1"): categories = catarray.cat.categories self.value_labels = list(zip(np.arange(len(categories)), categories)) self.value_labels.sort(key=lambda x: x[0]) - self.text_len = np.int32(0) - self.off = [] - self.val = [] - self.txt = [] + self.text_len = 0 + self.off: List[int] = [] + self.val: List[int] = [] + self.txt: List[bytes] = [] self.n = 0 # Compute lengths and setup lists of offsets and labels @@ -2131,7 +2131,7 @@ def _prepare_categoricals(self, data: DataFrame) -> DataFrame: is_cat = [is_categorical_dtype(data[col]) for col in data] self._is_col_cat = is_cat - self._value_labels = [] + self._value_labels: List[StataValueLabel] = [] if not any(is_cat): return data @@ -2290,8 +2290,8 @@ def _check_column_names(self, data: DataFrame) -> DataFrame: return data def _set_formats_and_types(self, dtypes: Series) -> None: - self.typlist = [] - self.fmtlist = [] + self.fmtlist: List[str] = [] + self.typlist: List[int] = [] for col, dtype in dtypes.items(): self.fmtlist.append(_dtype_to_default_stata_fmt(dtype, self.data[col])) self.typlist.append(_dtype_to_stata_type(dtype, self.data[col]))