Rank features using Random Forest classifier and the recursive feature elimination

def rank_features(self, inputs: pd.DataFrame, targets: pd.DataFrame, problem_type='classification') -> pd.DataFrame:
        """ Rank features using Random Forest classifier and the recursive feature elimination

        """
        try:

            X = normalize( \
                                inputs.apply(pd.to_numeric, errors='coerce') \
                                .applymap(lambda x: 0.0 if np.isnan(x) else x) \
                                .values, axis=0)
            y = targets.iloc[:,0].values
            original_columns = list(inputs)
            print(original_columns)

            if problem_type == 'classification':
                predictor = RandomForestClassifier()
            else:
                predictor = RandomForestRegressor()

            rfe = RFE(predictor, n_features_to_select=1)
            rfe = rfe.fit(X, y)
            
            best_features = [original_columns[i-1] for i in rfe.ranking_]

        except:
            logging.exception("Failed")
            # If any error occurs, just return indices in original order
            # In the future we should consider a better error handling strategy
            best_features = [i for i in range(inputs.shape[1])]

        return best_features