statsmodels.iolib.foreign.genfromdta

statsmodels.iolib.foreign.genfromdta(fname, missing_flt=-999.0, encoding=None, pandas=False, convert_dates=True)[source]

Returns an ndarray or DataFrame from a Stata .dta file.

Parameters
fnamestr or filehandle

Stata .dta file.

missing_fltnumeric

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

encodingstr, optional

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

pandasbool

Optionally return a DataFrame instead of an ndarray

convert_datesbool

If convert_dates is True, then Stata formatted dates will be converted to datetime types according to the variable’s format.