BUG: regression: pandas.read_stata(filename, iterator=True) raises ValueError · Issue #37280 · pandas-dev/pandas (original) (raw)


Code Sample, a copy-pastable example

import pandas

for example https://gitlab.com/ViDA-NYU/datamart/datamart/-/blob/master/tests/data/stata118.dta

iterator = pandas.read_stata(stata_file_name, iterator=True) list(iterator) Traceback (most recent call last): File "", line 1, in File "site-packages/pandas/io/stata.py", line 1523, in next raise ValueError( ValueError: chunksize must be set to a positive integer to use as an iterator.

Problem description

read_stata(filename, iterator=True) no longer works in pandas 1.1.3. It worked in pandas 1.0.5.

Expected Output

DataFrame is loaded correctly

Output of pd.show_versions()

INSTALLED VERSIONS
------------------
commit           : db08276bc116c438d3fdee492026f8223584c477
python           : 3.8.5.final.0
python-bits      : 64
OS               : Linux
OS-release       : 5.4.0-51-generic
Version          : #56-Ubuntu SMP Mon Oct 5 14:28:49 UTC 2020
machine          : x86_64
processor        : x86_64
byteorder        : little
LC_ALL           : None
LANG             : en_US.UTF-8
LOCALE           : en_US.UTF-8

pandas           : 1.1.3
numpy            : 1.19.2
pytz             : 2020.1
dateutil         : 2.8.1
pip              : 20.0.2
setuptools       : 44.0.0
Cython           : None
pytest           : None
hypothesis       : None
sphinx           : 3.2.1
blosc            : None
feather          : None
xlsxwriter       : None
lxml.etree       : None
html5lib         : None
pymysql          : None
psycopg2         : None
jinja2           : 2.11.2
IPython          : 7.14.0
pandas_datareader: None
bs4              : None
bottleneck       : None
fsspec           : 0.8.4
fastparquet      : None
gcsfs            : 0.7.1
matplotlib       : None
numexpr          : None
odfpy            : None
openpyxl         : None
pandas_gbq       : None
pyarrow          : None
pytables         : None
pyxlsb           : None
s3fs             : 0.4.2
scipy            : 1.5.3
sqlalchemy       : None
tables           : None
tabulate         : None
xarray           : None
xlrd             : 1.2.0
xlwt             : None
numba            : None