Beispiel #1
0
    def __SetNewData(self, data_container, case_index):
        array, label, feature_name, case_name = data_container.GetData()

        new_array = array[case_index, :]
        new_label = label[case_index]
        new_case_name = [case_name[i] for i in case_index]

        new_data_container = DataContainer(array=new_array, label=new_label, case_name=new_case_name, feature_name=feature_name)
        new_data_container.UpdateFrameByData()
        return new_data_container
Beispiel #2
0
 def _MergeClinical(self, dc, cli_df):
     # Merge DataContainer and a dataframe of clinical
     if 'label' in cli_df.columns.tolist():
         del cli_df['label']
     elif 'Label' in cli_df.columns.tolist():
         del cli_df['Label']
     df = pd.merge(dc.GetFrame(), cli_df, how='left', left_index=True, right_index=True)
     merge_dc = DataContainer()
     merge_dc.SetFrame(df)
     merge_dc.UpdateFrameByData()
     return merge_dc