@@ -1856,8 +1856,11 @@ def to_stata(self, fname, convert_dates=None, write_index=True,
1856
1856
1857
1857
Parameters
1858
1858
----------
1859
- fname : str, file descriptor or pathlib.Path
1860
- String or path to file which needs to be converted.
1859
+ fname : str, buffer or path object
1860
+ String, path object (pathlib.Path or py._path.local.LocalPath) or
1861
+ object implementing a binary write() function. If using a buffer
1862
+ then the buffer will not be automatically closed after the file
1863
+ data has been written.
1861
1864
convert_dates : dict
1862
1865
Dictionary mapping columns containing datetime types to stata
1863
1866
internal format to use when writing the dates. Options are 'tc',
@@ -1914,18 +1917,16 @@ def to_stata(self, fname, convert_dates=None, write_index=True,
1914
1917
1915
1918
See Also
1916
1919
--------
1917
- pandas. read_stata : Import Stata data files.
1918
- pandas. io.stata.StataWriter : Writer for Stata data files.
1919
- pandas. io.stata.StataWriter117 : Writer for version 117 files.
1920
+ read_stata : Import Stata data files.
1921
+ io.stata.StataWriter : Writer for Stata data files.
1922
+ io.stata.StataWriter117 : Writer for version 117 files.
1920
1923
1921
1924
Examples
1922
1925
--------
1923
- Converting DataFrame to Stata "dta" file using the to_stata method.
1924
-
1925
1926
>>> df = pd.DataFrame({'animal': ['falcon', 'parrot', 'falcon',
1926
1927
... 'parrot'],
1927
1928
... 'speed': [350, 18, 361, 15]})
1928
- >>> df.to_stata('animals.dta')
1929
+ >>> df.to_stata('animals.dta') # doctest: +SKIP
1929
1930
"""
1930
1931
kwargs = {}
1931
1932
if version not in (114 , 117 ):
0 commit comments