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.


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.

encoding : string, optional

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

pandas : bool

Optionally return a DataFrame instead of an ndarray

convert_dates : bool

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