diff --git a/ci/code_checks.sh b/ci/code_checks.sh index 2e42912965f97d..abef6533334a7a 100755 --- a/ci/code_checks.sh +++ b/ci/code_checks.sh @@ -131,7 +131,7 @@ if [[ -z "$CHECK" || "$CHECK" == "doctests" ]]; then MSG='Doctests frame.py' ; echo $MSG pytest -q --doctest-modules pandas/core/frame.py \ - -k"-axes -combine -itertuples -join -nunique -pivot_table -quantile -query -reindex -reindex_axis -replace -round -set_index -stack -to_stata" + -k"-axes -combine -itertuples -join -nunique -pivot_table -quantile -query -reindex -reindex_axis -replace -round -set_index -stack" RET=$(($RET + $?)) ; echo $MSG "DONE" MSG='Doctests series.py' ; echo $MSG diff --git a/pandas/core/frame.py b/pandas/core/frame.py index 742df627034537..491a847362e60d 100644 --- a/pandas/core/frame.py +++ b/pandas/core/frame.py @@ -1856,8 +1856,11 @@ def to_stata(self, fname, convert_dates=None, write_index=True, Parameters ---------- - fname : str, file descriptor or pathlib.Path - String or path to file which needs to be converted. + fname : str, buffer or path object + String, path object (pathlib.Path or py._path.local.LocalPath) or + object implementing a binary write() function. If using a buffer + then the buffer will not be automatically closed after the file + data has been written. convert_dates : dict Dictionary mapping columns containing datetime types to stata 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, See Also -------- - pandas.read_stata : Import Stata data files. - pandas.io.stata.StataWriter : Writer for Stata data files. - pandas.io.stata.StataWriter117 : Writer for version 117 files. + read_stata : Import Stata data files. + io.stata.StataWriter : Writer for Stata data files. + io.stata.StataWriter117 : Writer for version 117 files. Examples -------- - Converting DataFrame to Stata "dta" file using the to_stata method. - >>> df = pd.DataFrame({'animal': ['falcon', 'parrot', 'falcon', ... 'parrot'], ... 'speed': [350, 18, 361, 15]}) - >>> df.to_stata('animals.dta') + >>> df.to_stata('animals.dta') # doctest: +SKIP """ kwargs = {} if version not in (114, 117):