1

I'm trying to build a logistic regression in python with a dataset that contains continuous features and some binary features.

In order to choose the features that I will include in the model I am using RFE. So basically I have this code

y=HRData['left']
collist = HRData.columns.tolist()
collist.remove('left')
X=HRData[collist]
model = LogisticRegression()
rfe = RFE(model, 10)
fit = rfe.fit(HRData[X], HRData[y])

where y contains 1's and 0's and X has either int or float data.

When I try to fit the model with RFE I keep getting this:

/anaconda3/lib/python3.6/site-packages/pandas/core/frame.py in 
_getitem_frame(self, key)
   2033     def _getitem_frame(self, key):
   2034         if key.values.size and not is_bool_dtype(key.values):
-> 2035             raise ValueError('Must pass DataFrame with boolean values only')
   2036         return self.where(key)
   2037 

ValueError: Must pass DataFrame with boolean values only

So I am not sure if this function only admits data frames with boolean values since I've seen examples with continuous variables.

Thanks in advance for your help!

0 Answers0