@@ -1849,18 +1849,15 @@ def to_stata(self, fname, convert_dates=None, write_index=True,
18491849 data_label = None , variable_labels = None , version = 114 ,
18501850 convert_strl = None ):
18511851 """
1852- Converting data frame object to Stata dta format.
1852+ Converting DataFrame object to Stata dta format.
18531853
1854- Writes the Dataframe to a Stata dataset file.
1854+ Writes the DataFrame to a Stata dataset file.
18551855 "dta" files contain a Stata dataset.
18561856
18571857 Parameters
18581858 ----------
1859- fname : path (string), buffer or path object
1860- String, path object (pathlib.Path or py._path.local.LocalPath) or
1861- object implementing a binary write() functions. If using a buffer
1862- then the buffer will not be automatically closed after the file
1863- data has been written.
1859+ fname : str, file descriptor or pathlib.Path
1860+ String or path to file which needs to be converted.
18641861 convert_dates : dict
18651862 Dictionary mapping columns containing datetime types to stata
18661863 internal format to use when writing the dates. Options are 'tc',
@@ -1902,10 +1899,6 @@ def to_stata(self, fname, convert_dates=None, write_index=True,
19021899
19031900 .. versionadded:: 0.23.0
19041901
1905- Returns
1906- ------
1907- Stata (dta) file or StataWriter.
1908-
19091902 Raises
19101903 ------
19111904 NotImplementedError
@@ -1927,22 +1920,12 @@ def to_stata(self, fname, convert_dates=None, write_index=True,
19271920
19281921 Examples
19291922 --------
1930- Converting dataframe with date column to Stata dta file
1931- using the to_stata method.
1923+ Converting DataFrame to Stata "dta" file using the to_stata method.
19321924
1933- >>> dates = pd.date_range(start='2018-01-01', periods=4)
1934- >>> df = pd.DataFrame({'date': dates,
1935- ... 'animal': ['falcon', 'parrot', 'falcon',
1925+ >>> df = pd.DataFrame({'animal': ['falcon', 'parrot', 'falcon',
19361926 ... 'parrot'],
1937- ... 'speed': [350, 18, 361, 15]}).set_index(['date',
1938- ... 'animal'])
1927+ ... 'speed': [350, 18, 361, 15]})
19391928 >>> df.to_stata('animals.dta')
1940-
1941- Alternatively you can create an instance of the StataWriter class
1942-
1943- >>> StataWriter = pd.io.stata.StataWriter
1944- >>> writer = StataWriter('animals.dta', df)
1945- >>> writer.write_file()
19461929 """
19471930 kwargs = {}
19481931 if version not in (114 , 117 ):
0 commit comments