From 63fdce7af04c9c13dd6bfa7164f0180c1cc69d94 Mon Sep 17 00:00:00 2001 From: Kyle Barron Date: Wed, 21 Feb 2018 11:58:50 -0500 Subject: [PATCH 1/2] Update to_stata() docstring --- pandas/core/frame.py | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/pandas/core/frame.py b/pandas/core/frame.py index d81d22173bfbd..f2c3108539069 100644 --- a/pandas/core/frame.py +++ b/pandas/core/frame.py @@ -1612,7 +1612,7 @@ def to_stata(self, fname, convert_dates=None, write_index=True, time_stamp : datetime A datetime to use as file creation date. Default is the current time. - dataset_label : str + data_label : str A label for the data set. Must be 80 characters or smaller. variable_labels : dict Dictionary containing columns as keys and variable labels as @@ -1635,13 +1635,11 @@ def to_stata(self, fname, convert_dates=None, write_index=True, Examples -------- - >>> writer = StataWriter('./data_file.dta', data) - >>> writer.write_file() + >>> data.to_stata('./data_file.dta') Or with dates - >>> writer = StataWriter('./date_data_file.dta', data, {2 : 'tw'}) - >>> writer.write_file() + >>> data.to_stata('./date_data_file.dta', {2 : 'tw'}) """ from pandas.io.stata import StataWriter writer = StataWriter(fname, self, convert_dates=convert_dates, From 59acd1e1ac30a5bb5f6adeb7ba6efd2b19aab555 Mon Sep 17 00:00:00 2001 From: Kyle Barron Date: Wed, 21 Feb 2018 17:56:20 -0500 Subject: [PATCH 2/2] Restore StataWriter instructions in docstring --- pandas/core/frame.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/pandas/core/frame.py b/pandas/core/frame.py index f2c3108539069..e34aaaae9b887 100644 --- a/pandas/core/frame.py +++ b/pandas/core/frame.py @@ -1640,6 +1640,16 @@ def to_stata(self, fname, convert_dates=None, write_index=True, Or with dates >>> data.to_stata('./date_data_file.dta', {2 : 'tw'}) + + Alternatively you can create an instance of the StataWriter class + + >>> writer = StataWriter('./data_file.dta', data) + >>> writer.write_file() + + With dates: + + >>> writer = StataWriter('./date_data_file.dta', data, {2 : 'tw'}) + >>> writer.write_file() """ from pandas.io.stata import StataWriter writer = StataWriter(fname, self, convert_dates=convert_dates,