File tree Expand file tree Collapse file tree 2 files changed +12
-4
lines changed
Expand file tree Collapse file tree 2 files changed +12
-4
lines changed Original file line number Diff line number Diff line change @@ -6097,6 +6097,14 @@ values will have ``object`` data type.
60976097 ``int64 `` for all integer types and ``float64 `` for floating point data. By default,
60986098 the Stata data types are preserved when importing.
60996099
6100+ .. note ::
6101+
6102+ All :class: `~pandas.io.stata.StataReader ` objects, whether created by :func: `~pandas.read_stata `
6103+ (when using ``iterator=True `` or ``chunksize ``) or instantiated by hand, must be used as context
6104+ managers (e.g. the ``with `` statement).
6105+ The :meth: `~pandas.io.stata.StataReader.close ` method is available, but is unsupported, not part
6106+ of the public API, and may be removed in the future.
6107+
61006108.. ipython :: python
61016109 :suppress:
61026110
Original file line number Diff line number Diff line change 182182>>> df = pd.DataFrame(values, columns=["i"]) # doctest: +SKIP
183183>>> df.to_stata('filename.dta') # doctest: +SKIP
184184
185- >>> itr = pd.read_stata('filename.dta', chunksize=10000) # doctest: +SKIP
186- >>> for chunk in itr:
187- ... # Operate on a single chunk, e.g., chunk.mean()
188- ... pass # doctest: +SKIP
185+ >>> with pd.read_stata('filename.dta', chunksize=10000) as itr: # doctest: +SKIP
186+ >>> for chunk in itr:
187+ ... # Operate on a single chunk, e.g., chunk.mean()
188+ ... pass # doctest: +SKIP
189189"""
190190
191191_read_method_doc = f"""\
You can’t perform that action at this time.
0 commit comments