def __get_features_for_observation(self, data_frame=None, observation='LA-LL',
                                       skip_id=None, last_column_is_id=False):
        """
            Extract the features for a given observation from a data frame

            :param data_frame: data frame to get features from
            :type data_frame: pandas.DataFrame
            :param observation: observation name
            :type observation: string
            :param skip_id: skip any test with a given id (optional)
            :type skip_id: int
            :param last_column_is_id: skip the last column of the data frame (useful when id is last column - optional)
            :type last_column_is_id: bool
            :return features: the features
            :rtype features: np.array
        """
        try:
            features = np.array([])

            if data_frame is None:
                data_frame = self.data_frame

            for index, row in data_frame.iterrows():
                if not skip_id == row['id']:
                    features_row = np.nan_to_num(row[row.keys().str.contains(observation)].values)
                    features_row = np.append(features_row, row['id'])
                    features = np.vstack([features, features_row]) if features.size else features_row

            # not the same when getting a single point
            if last_column_is_id:
                if np.ndim(features) > 1:
                    to_return = features[:,:-1]
                else:
                    to_return = features[:-1]
            else:
                to_return = features

            return to_return, data_frame['id'].values
        except:
            logging.error(" observation not found in data frame")
def __get_features_for_observation ( self , data_frame = None , observation = 'LA-LL' , skip_id = None , last_column_is_id = False ) : try : features = np . array ( [ ] ) if data_frame is None : data_frame = self . data_frame for index , row in data_frame . iterrows ( ) : if not skip_id == row [ 'id' ] : features_row = np . nan_to_num ( row [ row . keys ( ) . str . contains ( observation ) ] . values ) features_row = np . append ( features_row , row [ 'id' ] ) features = np . vstack ( [ features , features_row ] ) if features . size else features_row if last_column_is_id : if np . ndim ( features ) > 1 : to_return = features [ : , : - 1 ] else : to_return = features [ : - 1 ] else : to_return = features return to_return , data_frame [ 'id' ] . values except : logging . error ( " observation not found in data frame" )
Extract the features for a given observation from a data frame

            :param data_frame: data frame to get features from
            :type data_frame: pandas.DataFrame
            :param observation: observation name
            :type observation: string
            :param skip_id: skip any test with a given id (optional)
            :type skip_id: int
            :param last_column_is_id: skip the last column of the data frame (useful when id is last column - optional)
            :type last_column_is_id: bool
            :return features: the features
            :rtype features: np.array