@@ -1706,7 +1706,6 @@ def read(
1706
1706
if (self ._nobs == 0 ) and (nrows is None ):
1707
1707
self ._can_read_value_labels = True
1708
1708
self ._data_read = True
1709
- self .close ()
1710
1709
return DataFrame (columns = self ._varlist )
1711
1710
1712
1711
# Handle options
@@ -1743,7 +1742,6 @@ def read(
1743
1742
# we are reading the file incrementally
1744
1743
if convert_categoricals :
1745
1744
self ._read_value_labels ()
1746
- self .close ()
1747
1745
raise StopIteration
1748
1746
offset = self ._lines_read * dtype .itemsize
1749
1747
self ._path_or_buf .seek (self ._data_location + offset )
@@ -1776,11 +1774,7 @@ def read(
1776
1774
data .index = Index (rng ) # set attr instead of set_index to avoid copy
1777
1775
1778
1776
if columns is not None :
1779
- try :
1780
- data = self ._do_select_columns (data , columns )
1781
- except ValueError :
1782
- self .close ()
1783
- raise
1777
+ data = self ._do_select_columns (data , columns )
1784
1778
1785
1779
# Decode strings
1786
1780
for col , typ in zip (data , self ._typlist ):
@@ -1819,13 +1813,9 @@ def any_startswith(x: str) -> bool:
1819
1813
cols = np .where ([any_startswith (x ) for x in self ._fmtlist ])[0 ]
1820
1814
for i in cols :
1821
1815
col = data .columns [i ]
1822
- try :
1823
- data [col ] = _stata_elapsed_date_to_datetime_vec (
1824
- data [col ], self ._fmtlist [i ]
1825
- )
1826
- except ValueError :
1827
- self .close ()
1828
- raise
1816
+ data [col ] = _stata_elapsed_date_to_datetime_vec (
1817
+ data [col ], self ._fmtlist [i ]
1818
+ )
1829
1819
1830
1820
if convert_categoricals and self ._format_version > 108 :
1831
1821
data = self ._do_convert_categoricals (
0 commit comments