From 6bb9ab8a60b9914bfc306ca3691130d583e02656 Mon Sep 17 00:00:00 2001 From: Ryan Nazareth Date: Wed, 10 Apr 2019 13:59:42 +0100 Subject: [PATCH] Remove pandas.io.stata from Typing Blacklist (#25940) --- mypy.ini | 3 --- pandas/io/stata.py | 12 ++++++------ 2 files changed, 6 insertions(+), 9 deletions(-) diff --git a/mypy.ini b/mypy.ini index ddfa9885e3351..483fc78ca9cc3 100644 --- a/mypy.ini +++ b/mypy.ini @@ -164,9 +164,6 @@ ignore_errors=True [mypy-pandas.io.pytables] ignore_errors=True -[mypy-pandas.io.stata] -ignore_errors=True - [mypy-pandas.util._doctools] ignore_errors=True diff --git a/pandas/io/stata.py b/pandas/io/stata.py index 7bc6f267d094e..5b186afdfdb3e 100644 --- a/pandas/io/stata.py +++ b/pandas/io/stata.py @@ -22,7 +22,6 @@ import numpy as np from pandas._libs.lib import infer_dtype -from pandas._libs.tslibs import NaT, Timestamp from pandas._libs.writers import max_len_string_array from pandas.compat import lmap, lrange, lzip from pandas.util._decorators import Appender, deprecate_kwarg @@ -31,8 +30,8 @@ ensure_object, is_categorical_dtype, is_datetime64_dtype) from pandas import ( - DatetimeIndex, compat, concat, isna, to_datetime, to_timedelta) -from pandas.core.arrays import Categorical + Categorical, DatetimeIndex, NaT, Timestamp, compat, concat, isna, + to_datetime, to_timedelta) from pandas.core.base import StringMixin from pandas.core.frame import DataFrame from pandas.core.series import Series @@ -1050,7 +1049,7 @@ def _read_new_header(self, first_char): self.nobs = self._get_nobs() self.path_or_buf.read(11) # self.time_stamp = self._get_time_stamp() self.path_or_buf.read(26) # @@ -1237,7 +1236,7 @@ def _read_old_header(self, first_char): self.path_or_buf.read(2))[0] self.nobs = self._get_nobs() - self.data_label = self._get_data_label() + self._data_label = self._get_data_label() self.time_stamp = self._get_time_stamp() @@ -1740,11 +1739,12 @@ def _do_convert_categoricals(self, data, value_label_dict, lbllist, data = DataFrame.from_dict(OrderedDict(cat_converted_data)) return data + @property def data_label(self): """ Return data label of Stata file. """ - return self.data_label + return self._data_label def variable_labels(self): """