aFrame.to_sql ](pandas.DataFrame.to_sql.html)
    * [ pandas.read_gbq ](pandas.read_gbq.html)
    * [ pandas.read_stata ](pandas.read_stata.html)
    * pandas.DataFrame.to_stata 
    * [ pandas.io.stata.StataReader.data_label ](pandas.io.stata.StataReader.data_label.html)
    * [ pandas.io.stata.StataReader.value_labels ](pandas.io.stata.StataReader.value_labels.html)
    * [ pandas.io.stata.StataReader.variable_labels ](pandas.io.stata.StataReader.variable_labels.html)
    * [ pandas.io.stata.StataWriter.write_file ](pandas.io.stata.StataWriter.write_file.html)
  * [ General functions ](../general_functions.html)
  * [ Series ](../series.html)
  * [ DataFrame ](../frame.html)
  * [ pandas arrays, scalars, and data types ](../arrays.html)
  * [ Index objects ](../indexing.html)
  * [ Date offsets ](../offset_frequency.html)
  * [ Window ](../window.html)
  * [ GroupBy ](../groupby.html)
  * [ Resampling ](../resampling.html)
  * [ Style ](../style.html)
  * [ Plotting ](../plotting.html)
  * [ Options and settings ](../options.html)
  * [ Extensions ](../extensions.html)
  * [ Testing ](../testing.html)
  * [ Missing values ](../missing_value.html)

  * [ __ ](../../index.html)
  * [ API reference ](../index.html)
  * [ Input/output ](../io.html)
  * pandas.DataF... 

#  pandas.DataFrame.to_stata  #

DataFrame.  to_stata  (  _ path  _ , _ *  _ , _ convert_dates  =  None  _ , _
write_index  =  True  _ , _ byteorder  =  None  _ , _ time_stamp  =  None  _ ,
_ data_label  =  None  _ , _ variable_labels  =  None  _ , _ version  =  114
_ , _ convert_strl  =  None  _ , _ compression  =  'infer'  _ , _
storage_options  =  None  _ , _ value_labels  =  None  _ )  [ [source]
](https://github.com/pandas-
dev/pandas/blob/v2.2.2/pandas/core/frame.py#L2756-L2907) #

    

Export DataFrame object to Stata dta format.

Writes the DataFrame to a Stata dataset file. âdtaâ files contain a Stata
dataset.

Parameters  :

    

**path** str, path object, or buffer

    

String, path object (implementing ` os.PathLike[str]  ` ), or file-like object
implementing a binary ` write()  ` function.

**convert_dates** dict

    

Dictionary mapping columns containing datetime types to stata internal format
to use when writing the dates. Options are âtcâ, âtdâ, âtmâ,
âtwâ, âthâ, âtqâ, âtyâ. Column can be either an integer or a
name. Datetime columns that do not have a conversion type specified will be
converted to âtcâ. Raises NotImplementedError if a datetime column has
timezone information.

**write_index** bool

    

Write the index to Stata dataset.

**byteorder** str

    

Can be â>â, â<â, âlittleâ, or âbigâ. default is  sys.byteorder
.

**time_stamp** datetime

    

A datetime to use as file creation date. Default is the current time.

**data_label** str, optional

    

A label for the data set. Must be 80 characters or smaller.

**variable_labels** dict

    

Dictionary containing columns as keys and variable labels as values. Each
label must be 80 characters or smaller.

**version** {114, 117, 118, 119, None}, default 114

    

Version to use in the output dta file. Set to None to let pandas decide
between 118 or 119 formats depending on the number of columns in the frame.
Version 114 can be read by Stata 10 and later. Version 117 can be read by
Stata 13 or later. Version 118 is supported in Stata 14 and later. Version 119
is supported in Stata 15 and later. Version 114 limits string variables to 244
characters or fewer while versions 117 and later allow strings with lengths up
to 2,000,000 characters. Versions 118 and 119 support Unicode characters, and
version 119 supports more than 32,767 variables.

Version 119 should usually only be used when the number of variables exceeds
the capacity of dta format 118. Exporting smaller datasets in format 119 may
have unintended consequences, and, as of November 2020, Stata SE cannot read
version 119 files.

**convert_strl** list, optional

    

List