Logo

statsmodels.iolib.foreign.genfromdta

statsmodels.iolib.foreign.genfromdta(fname, missing_flt=-999.0, missing_str='', encoding=None)[source]

Returns an ndarray from a Stata .dta file.

Parameters:

fname : str or filehandle

Stata .dta file.

missing_flt : numeric

The numeric value to replace missing values with. Will be used for any numeric value.

missing_str : str

The string to replace missing values with for string variables.

encoding : string, optional

Used for Python 3 only. Encoding to use when reading the .dta file. Defaults to locale.getpreferredencoding

Notes

Date types will be returned as their numeric value in Stata. A date parser is not written yet.

Previous topic

statsmodels.iolib.foreign.StataReader.variables

Next topic

statsmodels.iolib.foreign.savetxt

This Page