@@ -1846,18 +1846,15 @@ def to_stata(self, fname, convert_dates=None, write_index=True,
18461846 data_label = None , variable_labels = None , version = 114 ,
18471847 convert_strl = None ):
18481848 """
1849- Converting data frame object to Stata dta format.
1849+ Converting DataFrame object to Stata dta format.
18501850
1851- Writes the Dataframe to a Stata dataset file.
1851+ Writes the DataFrame to a Stata dataset file.
18521852 "dta" files contain a Stata dataset.
18531853
18541854 Parameters
18551855 ----------
1856- fname : path (string), buffer or path object
1857- String, path object (pathlib.Path or py._path.local.LocalPath) or
1858- object implementing a binary write() functions. If using a buffer
1859- then the buffer will not be automatically closed after the file
1860- data has been written.
1856+ fname : str, file descriptor or pathlib.Path
1857+ String or path to file which needs to be converted.
18611858 convert_dates : dict
18621859 Dictionary mapping columns containing datetime types to stata
18631860 internal format to use when writing the dates. Options are 'tc',
@@ -1899,10 +1896,6 @@ def to_stata(self, fname, convert_dates=None, write_index=True,
18991896
19001897 .. versionadded:: 0.23.0
19011898
1902- Returns
1903- ------
1904- Stata (dta) file or StataWriter.
1905-
19061899 Raises
19071900 ------
19081901 NotImplementedError
@@ -1924,22 +1917,12 @@ def to_stata(self, fname, convert_dates=None, write_index=True,
19241917
19251918 Examples
19261919 --------
1927- Converting dataframe with date column to Stata dta file
1928- using the to_stata method.
1920+ Converting DataFrame to Stata "dta" file using the to_stata method.
19291921
1930- >>> dates = pd.date_range(start='2018-01-01', periods=4)
1931- >>> df = pd.DataFrame({'date': dates,
1932- ... 'animal': ['falcon', 'parrot', 'falcon',
1922+ >>> df = pd.DataFrame({'animal': ['falcon', 'parrot', 'falcon',
19331923 ... 'parrot'],
1934- ... 'speed': [350, 18, 361, 15]}).set_index(['date',
1935- ... 'animal'])
1924+ ... 'speed': [350, 18, 361, 15]})
19361925 >>> df.to_stata('animals.dta')
1937-
1938- Alternatively you can create an instance of the StataWriter class
1939-
1940- >>> StataWriter = pd.io.stata.StataWriter
1941- >>> writer = StataWriter('animals.dta', df)
1942- >>> writer.write_file()
19431926 """
19441927 kwargs = {}
19451928 if version not in (114 , 117 ):
0 commit comments