larray.LArray.to_stata

LArray.to_stata(self, filepath_or_buffer, **kwargs)[source]

Writes array to a Stata .dta file.

Parameters
filepath_or_bufferstr or file-like object

Path to .dta file or a file handle.

See also

read_stata

Notes

The round trip to Stata (LArray.to_stata followed by read_stata) loose the name of the “column” axis.

Examples

>>> axes = [Axis(3, 'row'), Axis('column=country,sex')]    # doctest: +SKIP
>>> arr = LArray([['BE', 'F'],
...               ['FR', 'M'],
...               ['FR', 'F']], axes=axes)                 # doctest: +SKIP
>>> arr                                                    # doctest: +SKIP
row*\column  age  sex
          0    5    F
          1   25    M
          2   30    F
>>> arr.to_stata('test.dta')                               # doctest: +SKIP