DTA 118 and 119 format files support unicode string data (both fixed and strL) format. Unicode is also supported in value labels, variable labels and the dataset label. Format 119 is automatically used if the file contains more than 32,767 variables.
string, path object (pathlib.Path or py._path.local.LocalPath) or object implementing a binary write() functions. If using a buffer then the buffer will not be automatically closed after the file is written.
Input to save
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 the index to Stata dataset.
Can be ">", "<", "little", or "big". default is :None:None:`sys.byteorder`
A datetime to use as file creation date. Default is the current time
A label for the data set. Must be 80 characters or smaller.
Dictionary containing columns as keys and variable labels as values. Each label must be 80 characters or smaller.
List of columns names to convert to Stata StrL format. Columns with more than 2045 characters are automatically written as StrL. Smaller columns can be converted by including the column name. Using StrLs can reduce output file size when strings are longer than 8 characters, and either frequently repeated or sparse.
The dta version to use. By default, uses the size of data to determine the version. 118 is used if data.shape[1] <= 32767, and 119 is used for storing larger DataFrames.
Dictionary containing columns as keys and dictionaries of column value to labels as values. The combined length of all labels for a single variable must be 32,000 characters or smaller.
If datetimes contain timezone information
Columns listed in convert_dates are neither datetime64[ns] or datetime.datetime
Column dtype is not representable in Stata
Column listed in convert_dates is not in DataFrame
Categorical label contains more than 32,000 characters
The instance has a write_file method, which will write the file to the given :None:None:`fname`
.
Stata binary dta file writing in Stata 15 (118) and 16 (119) formats
Using Unicode data and column names
This example is valid syntax, but we were not able to check execution>>> from pandas.io.stata import StataWriterUTF8
... data = pd.DataFrame([[1.0, 1, 'ᴬ']], columns=['a', 'β', 'ĉ'])
... writer = StataWriterUTF8('./data_file.dta', data)
... writer.write_file()
Directly write a zip file >>> compression = {"method": "zip", "archive_name": "data_file.dta"} >>> writer = StataWriterUTF8('./data_file.zip', data, compression=compression) >>> writer.write_file()
Or with long strings stored in strl format
This example is valid syntax, but we were not able to check execution>>> data = pd.DataFrame([['ᴀ relatively long ŝtring'], [''], ['']],See :
... columns=['strls'])
... writer = StataWriterUTF8('./data_file_with_long_strings.dta', data,
... convert_strl=['strls'])
... writer.write_file()
The following pages refer to to this document either explicitly or contain code examples using this.
pandas.io.stata.StataWriterUTF8
Hover to see nodes names; edges to Self not shown, Caped at 50 nodes.
Using a canvas is more power efficient and can get hundred of nodes ; but does not allow hyperlinks; , arrows or text (beyond on hover)
SVG is more flexible but power hungry; and does not scale well to 50 + nodes.
All aboves nodes referred to, (or are referred from) current nodes; Edges from Self to other have been omitted (or all nodes would be connected to the central node "self" which is not useful). Nodes are colored by the library they belong to, and scaled with the number of references pointing them