@@ -2221,14 +2221,14 @@ def read_stata(
2221
2221
iterator : bool, default False
2222
2222
Return StataReader object.
2223
2223
compression : str or dict, default 'infer'
2224
- For on-the-fly decompression of on-disk data. If 'infer' and 'filepath_or_buffer' is
2225
- path-like, then detect compression from the following extensions: '.gz',
2226
- '.bz2', '.zip ', '.xz ', '.zst ', '.tar ', '.tar.gz ', '.tar.xz' or '.tar.bz2'
2227
- (otherwise no compression).
2228
- If using 'zip' or 'tar', the ZIP file must contain only one data file to be read in.
2229
- Set to ``None`` for no decompression.
2230
- Can also be a dict with key ``'method'`` set
2231
- to one of {``'zip'``, ``'gzip'``, ``'bz2'``, ``'zstd'``, ``'xz'``, ``'tar'``} and
2224
+ For on-the-fly decompression of on-disk data. If 'infer' and
2225
+ 'filepath_or_buffer' is path-like, then detect compression from the
2226
+ following extensions: '.gz ', '.bz2 ', '.zip ', '.xz ', '.zst ', '.tar',
2227
+ '.tar.gz', '.tar.xz' or '.tar.bz2' (otherwise no compression).
2228
+ If using 'zip' or 'tar', the ZIP file must contain only one
2229
+ data file to be read in. Set to ``None`` for no decompression.
2230
+ Can also be a dict with key ``'method'`` set to one of
2231
+ {``'zip'``, ``'gzip'``, ``'bz2'``, ``'zstd'``, ``'xz'``, ``'tar'``} and
2232
2232
other key-value pairs are forwarded to
2233
2233
``zipfile.ZipFile``, ``gzip.GzipFile``,
2234
2234
``bz2.BZ2File``, ``zstandard.ZstdDecompressor``, ``lzma.LZMAFile`` or
@@ -2271,19 +2271,25 @@ def read_stata(
2271
2271
2272
2272
Creating a dummy stata for this example
2273
2273
2274
- >>> df = pd.DataFrame({'animal': ['falcon', 'parrot', 'falcon', 'parrot'],
2275
- ... 'speed': [350, 18, 361, 15]}) # doctest: +SKIP
2276
- >>> df.to_stata('animals.dta') # doctest: +SKIP
2274
+ >>> df = pd.DataFrame(
2275
+ ... {
2276
+ ... "animal": ["falcon", "parrot", "falcon", "parrot"],
2277
+ ... "speed": [350, 18, 361, 15],
2278
+ ... }
2279
+ ... ) # doctest: +SKIP
2280
+ >>> df.to_stata("animals.dta") # doctest: +SKIP
2277
2281
2278
2282
Read a Stata dta file:
2279
2283
2280
- >>> df = pd.read_stata(' animals.dta' ) # doctest: +SKIP
2284
+ >>> df = pd.read_stata(" animals.dta" ) # doctest: +SKIP
2281
2285
2282
2286
Read a Stata dta file in 10,000 line chunks:
2283
2287
2284
- >>> values = np.random.randint(0, 10, size=(20_000, 1), dtype="uint8") # doctest: +SKIP
2288
+ >>> values = np.random.randint(
2289
+ ... 0, 10, size=(20_000, 1), dtype="uint8"
2290
+ ... ) # doctest: +SKIP
2285
2291
>>> df = pd.DataFrame(values, columns=["i"]) # doctest: +SKIP
2286
- >>> df.to_stata(' filename.dta' ) # doctest: +SKIP
2292
+ >>> df.to_stata(" filename.dta" ) # doctest: +SKIP
2287
2293
2288
2294
>>> with pd.read_stata('filename.dta', chunksize=10000) as itr: # doctest: +SKIP
2289
2295
>>> for chunk in itr:
0 commit comments