File tree 2 files changed +12
-4
lines changed
2 files changed +12
-4
lines changed Original file line number Diff line number Diff line change @@ -6042,6 +6042,14 @@ values will have ``object`` data type.
6042
6042
``int64 `` for all integer types and ``float64 `` for floating point data. By default,
6043
6043
the Stata data types are preserved when importing.
6044
6044
6045
+ .. note ::
6046
+
6047
+ All :class: `~pandas.io.stata.StataReader ` objects, whether created by :func: `~pandas.read_stata `
6048
+ (when using ``iterator=True `` or ``chunksize ``) or instantiated by hand, must be used as context
6049
+ managers (e.g. the ``with `` statement).
6050
+ While the :meth: `~pandas.io.stata.StataReader.close ` method is available, its use is unsupported.
6051
+ It is not part of the public API and will be removed in with future without warning.
6052
+
6045
6053
.. ipython :: python
6046
6054
:suppress:
6047
6055
Original file line number Diff line number Diff line change 183
183
>>> df = pd.DataFrame(values, columns=["i"]) # doctest: +SKIP
184
184
>>> df.to_stata('filename.dta') # doctest: +SKIP
185
185
186
- >>> itr = pd.read_stata('filename.dta', chunksize=10000) # doctest: +SKIP
187
- >>> for chunk in itr:
188
- ... # Operate on a single chunk, e.g., chunk.mean()
189
- ... pass # doctest: +SKIP
186
+ >>> with pd.read_stata('filename.dta', chunksize=10000) as itr: # doctest: +SKIP
187
+ >>> for chunk in itr:
188
+ ... # Operate on a single chunk, e.g., chunk.mean()
189
+ ... pass # doctest: +SKIP
190
190
"""
191
191
192
192
_read_method_doc = f"""\
You can’t perform that action at this time.
0 commit comments