By default, Logit does not validate your data for unprocessed infinities ( np.inf ) or NaNs ( np.nan ). In pandas, the latter usually indicates a missing entry.
To ignore rows with missing data and continue, use missing='drop' as follows:
sm.Logit(data['admit'], data[train_cols], missing='drop')
Refer to Logit docs for other options.
If you do not expect your data to contain any missing entries or infinities, you may have downloaded them incorrectly. See data[data.isnull()] to find out where the problem is. (NB Read this to find out how to make the register inf as null.)
source share