diff --git a/pandas/io/stata.py b/pandas/io/stata.py index a85abb9be843f1..aff825ba902d4e 100644 --- a/pandas/io/stata.py +++ b/pandas/io/stata.py @@ -1240,7 +1240,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() diff --git a/pandas/tests/io/test_stata.py b/pandas/tests/io/test_stata.py index 420ccfc885ef01..7fe99fcf6fd5a1 100644 --- a/pandas/tests/io/test_stata.py +++ b/pandas/tests/io/test_stata.py @@ -301,7 +301,7 @@ def test_read_dta18(self): 'Floats': 'float data'} tm.assert_dict_equal(vl, vl_expected) - assert rdr.data_label == 'This is a Ünicode data label' + assert rdr._data_label == 'This is a Ünicode data label' def test_read_write_dta5(self): original = DataFrame([(np.nan, np.nan, np.nan, np.nan, np.nan)], @@ -499,7 +499,7 @@ def test_timestamp_and_label(self, version): with StataReader(path) as reader: assert reader.time_stamp == '29 Feb 2000 14:21' - assert reader.data_label == data_label + assert reader._data_label == data_label @pytest.mark.parametrize('version', [114, 117]) def test_invalid_timestamp(self, version):