Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TYP: Remove pandas.io.stata from Typing Blacklist #25940

Merged
merged 11 commits into from
Apr 10, 2019
Merged
3 changes: 0 additions & 3 deletions mypy.ini
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
12 changes: 6 additions & 6 deletions pandas/io/stata.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -1050,7 +1049,7 @@ def _read_new_header(self, first_char):

self.nobs = self._get_nobs()
self.path_or_buf.read(11) # </N><label>
self.data_label = self._get_data_label()
self._data_label = self._get_data_label()
self.path_or_buf.read(19) # </label><timestamp>
self.time_stamp = self._get_time_stamp()
self.path_or_buf.read(26) # </timestamp></header><map>
Expand Down Expand Up @@ -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()

Expand Down Expand Up @@ -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):
"""
Expand Down